I'm trying to change the markup around articles being displayed on the front page of a drupal site so I can integrate them into a slideshow. (I can't use a slideshow module). I have a page--front.tpl.php file, but I need to add more specific markup than I can do here.
How do you go about changing the markup for just a specific area of the front page?
I believe I need to write a preprocess hook, but I'm not sure how to target just the articles node on the front page. This is the markup I would like to have generated:
<div class="slidewrap" data-autorotate="5000">
<ul class="slidecontrols">
<li>Next</li>
<li>Prev</li>
</ul>
<ul class="slider" id="sliderName">
<li class="slide">
<h2 class="slidehed">First Slide</h2>
<img src="1.jpg" />
<p>In hac habitasse platea dictumst. Nam pulvinar, odio sed rhoncus suscipit, sem diam ultrices mauris, eu consequat purus metus eu velit. Proin metus odio, aliquam eget molestie nec, gravida ut sapien. Phasellus quis est sed turpis sollicitudin venenatis sed eu odio. Praesent eget neque eu eros interdum malesuada non vel leo. Sed fringilla porta ligula egestas tincidunt. Nullam risus magna, ornare vitae varius eget, scelerisque a libero.</p>
</li>
<li class="slide">
<h2 class="slidehed">Second Slide</h2>
<img src="2.jpg" />
<p>In hac habitasse platea dictumst. Nam pulvinar, odio sed rhoncus suscipit, sem diam ultrices mauris, eu consequat purus metus eu velit. Proin metus odio, aliquam eget molestie nec, gravida ut sapien.</p>
</li>
<li class="slide">
<h2 class="slidehed">Third Slide</h2>
<img src="3.jpg" />
<p>Phasellus quis est sed turpis sollicitudin venenatis sed eu odio. Praesent eget neque eu eros interdum malesuada non vel leo. Sed fringilla porta ligula egestas tincidunt. Nullam risus magna, ornare vitae varius eget.</p>
</li>
<li class="slide">
<h2 class="slidehed">Fourth Slide</h2>
<p>In hac habitasse platea dictumst. Nam pulvinar, odio sed rhoncus suscipit, sem diam ultrices mauris, eu consequat purus metus eu velit. Proin metus odio, aliquam eget molestie nec, gravida ut sapien. Phasellus quis est sed turpis sollicitudin venenatis sed eu odio.</p>
</li>
<li class="slide">
<h2 class="slidehed">Fif' Slide</h2>
<p>In hac habitasse platea dictumst. Nam pulvinar, odio sed rhoncus suscipit, sem diam ultrices mauris, eu consequat purus metus eu velit. Proin metus odio, aliquam eget molestie nec, gravida ut sapien.</p>
</li>
</ul>
</div>
I've been trying to do this using the views module. However, when I create a new template I get this error message:
Warning: Invalid argument supplied for foreach() in include() (line 12 of /d7install/path_to_theme/views-view--featured--block.tpl.php).
Here is the template file that I copied via the Theme Information:
<?php if (!empty($title)): ?>
<h3><?php print $title; ?></h3>
<?php endif; ?>
<?php foreach ($rows as $id => $row): ?>
<div class="<?php print $classes_array[$id]; ?>">
<?php print $row; ?>
</div>
<?php endforeach; ?>
there is a simple solution. Add a new template for article content types. node-article.tpl.php. And then add an if statement to that, if the article is on the front page, show markup A, else show markup B. Like:
if (drupal_is_front_page()) {
<article class='front-page'>Article</article>
}
else
{
<article class='other-page'>Article</article>
}
This can all be achieved by the views module: http://drupal.org/project/views
Create a block display and have it show only on the home page. There should be no need for a custom views template.
You can add the .slidercontrols UL to the header of the view. Also if you need the attribute on the outer div just add it via jQuery with something like this.
$('.slidewrap').attr('data-autorotate', 5000);
Related
I try to do a sidebar that we can collapse (hide) or display, the goal is that the sidebar kind of push the content on the right.
I've done that, but when I display the sidebar the content is compressed/not pushed, we keep the responsivity.
If I add flex-shrink-0 to the main part, it works well for the sidebar push content behavior, but I totally loose responsivity.
I would like somthink like https://fontawesome.com/ when the view is minimised, I don't know how explain it.
#sidebar.collapsing.width {
height: auto;
width: 0;
overflow: hidden;
transition: width .35s ease;
}
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>The page title</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.0-beta3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons#1.4.1/font/bootstrap-icons.css">
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.0.0-beta3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-JEW9xMcG8R+pH31jmWH6WWP0WintQrMb4s7ZOdauHnUtxwoG2vI5DkLtS3qm9Ekf"
crossorigin="anonymous"></script>
</head>
<body>
<div class="d-flex align-items-stretch vh-100">
<nav>
<div id="sidebar" class="h-100 collapse width show">
<div class="h-100 d-flex flex-column p-2 text-white bg-dark" style="width: 280px;">
<a class="m-2" href="#">
<img src="https://via.placeholder.com/110x50?text=Logo" alt="Aviron Tours Métropole">
</a>
<hr>
<ul class="nav flex-column">
<li class="nav-item">
<a class="nav-link text-light" href="#">Link 1</a>
</li>
<li class="nav-item">
<a class="nav-link text-light" href="#">Link 2</a>
</li>
<li class="nav-item">
<a class="nav-link text-light" href="#">Link 3</a>
</li>
<li class="nav-item">
<a class="nav-link text-light" href="#">Link 4</a>
</li>
</ul>
<hr class="mt-auto">
<ul class="nav flex-column small">
<li class="nav-item">
<a class="nav-link link-secondary" href="#">Link 1</a>
</li>
<li class="nav-item">
<a class="nav-link link-secondary" href="#">Link 2</a>
</li>
</ul>
<hr>
<div class="dropdown">
<a href="#" class="d-flex align-items-center text-white text-decoration-none dropdown-toggle"
id="dropdownUser1" data-bs-toggle="dropdown" aria-expanded="false">
<img src="https://robohash.org/JD.png?set=set4"
alt="mdo" width="32" height="32" class="rounded-circle me-2">
<strong>John Doe</strong>
</a>
<ul class="dropdown-menu dropdown-menu-dark text-small shadow" aria-labelledby="dropdownUser1">
<li><a class="dropdown-item" href="#">My profile</a></li>
<li>
<hr class="dropdown-divider">
</li>
<li><a class="dropdown-item" href="#">Logout</a></li>
</ul>
</div>
</div>
</div>
</nav>
<div class="flex-grow-1 overflow-auto bg-light">
<nav class="d-flex bg-white shadow-sm" style="--bs-breadcrumb-divider: '>';" aria-label="breadcrumb">
<button id="toggle-sidebar" class="btn ms-2 me-3 py-3" type="button" data-bs-toggle="collapse"
data-bs-target="#sidebar" aria-expanded="true" aria-controls="sidebar">
<span class="bi bi-list"></span>
</button>
<ol class="breadcrumb mb-0 pt-3">
<li class="breadcrumb-item">
<a href="#">
<span class="bi bi-house-door-fill"></span> Home
</a>
</li>
</ol>
</nav>
<main class="my-3 px-3">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In vitae tellus suscipit, ultrices mauris a,
cursus nunc. Morbi odio enim, congue a dignissim et, rutrum ac nunc. Donec maximus ipsum nec diam
facilisis, quis aliquam justo pretium. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices
posuere cubilia curae; Sed porta sollicitudin nisi, tempus luctus dui semper scelerisque. Vivamus quis
turpis arcu. Aenean efficitur tortor vel neque ultricies mattis. Quisque eu pretium metus, sed pulvinar
nisl. Proin scelerisque ex non lacus ornare egestas. Pellentesque vel rhoncus tellus. Nullam laoreet
sapien nec enim blandit, nec pretium dolor tempus. Aliquam erat volutpat. Ut sit amet felis vulputate,
auctor neque at, tempus ipsum. Quisque tempus bibendum ultricies. Praesent non lectus tortor.
</p>
<p>
Integer hendrerit lectus non quam efficitur dapibus. Vestibulum blandit nisi at neque tincidunt aliquet.
Aenean rutrum risus sed eros imperdiet, sit amet venenatis justo faucibus. Proin at vestibulum sapien.
Nunc mollis odio ultricies, vulputate lacus quis, auctor elit. Curabitur vitae sem sed ipsum pretium
ullamcorper. Nunc rutrum, purus blandit ullamcorper luctus, mauris neque ultricies orci, a aliquam risus
tellus et erat. Suspendisse id risus sodales, varius enim at, rutrum purus.
</p>
<p>
Donec porta urna porta nisl eleifend ultricies. Aenean iaculis congue neque vitae posuere. Donec vitae
pellentesque leo, sed convallis eros. Fusce auctor scelerisque justo, sit amet lobortis augue tempus sit
amet. Aliquam erat volutpat. Duis id est tortor. Suspendisse arcu turpis, lobortis non auctor vitae,
accumsan sit amet risus. Suspendisse finibus mi bibendum libero elementum, vel malesuada elit sagittis.
</p>
<p>
Aenean in ipsum neque. Quisque ligula erat, maximus sed porta a, mattis et massa. Morbi a sapien
molestie, interdum sapien sed, tristique lectus. Integer hendrerit, lacus quis volutpat sodales, eros
nisi bibendum urna, non pharetra enim velit eu lectus. Nam dignissim nibh nec nunc finibus eleifend.
Praesent consequat molestie odio et auctor. Sed faucibus urna vel pretium viverra. Proin non mi eu
mauris mollis mattis eu quis ante. Sed auctor porttitor tellus, non porta diam posuere et. Integer
aliquam mi nulla, ac porttitor lacus efficitur vitae. Fusce tortor arcu, mollis eu lectus at, fringilla
mollis nisl. Integer quis aliquam risus. Phasellus vitae rhoncus dolor. Aenean eu urna a velit convallis
auctor.
</p>
<p>
Nam nunc ante, feugiat nec commodo ac, blandit nec sapien. Maecenas eget tempor nunc. Vivamus eu
malesuada ante. Sed porta elementum nunc ut vestibulum. Quisque facilisis eros aliquam, tristique quam
eu, scelerisque metus. Nulla ultricies elit at diam posuere, eu lobortis mauris pellentesque.
Pellentesque pulvinar tortor sit amet neque suscipit consectetur.
</p>
<p>
Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Etiam commodo
diam purus, nec dapibus neque aliquet eget. Aliquam in lobortis urna, nec bibendum sem. Praesent eget
ultricies neque. Morbi pharetra in velit id tristique. Mauris tristique sodales lacus accumsan gravida.
Integer sed lorem nec urna egestas mollis vitae id turpis. Sed non dolor odio. Etiam congue nunc pretium
nibh bibendum, vitae maximus dui dapibus. Donec euismod venenatis nisl, vel laoreet eros efficitur
molestie. Fusce pharetra, enim nec eleifend imperdiet, tellus quam bibendum tellus, vel blandit orci
sapien ut erat.
</p>
<p>
Nam bibendum nisi id scelerisque feugiat. Vestibulum cursus arcu sed elit blandit, ac hendrerit magna
iaculis. Mauris suscipit mauris a porttitor tempor. Vestibulum quis euismod risus, dictum blandit dui.
Praesent et sapien in dui blandit aliquam. Integer quis auctor augue. Ut efficitur aliquam condimentum.
Aenean dolor nibh, gravida non elit eget, euismod laoreet ipsum. Vestibulum iaculis diam sed felis
cursus pulvinar. Proin a purus varius, pulvinar quam nec, fringilla nisl. Morbi in nulla nisl. Sed in
ipsum quis lorem volutpat feugiat. Proin finibus consequat nisi varius ultrices. Donec ultricies finibus
tellus, aliquet viverra sapien tincidunt nec. Suspendisse mollis imperdiet vehicula. Sed commodo purus
vel mauris vulputate accumsan.
</p>
<p>
Proin ac massa quis orci dapibus interdum. Aenean semper ipsum ac urna pharetra ultrices. Nunc id
vehicula urna. Integer sollicitudin, enim sit amet fermentum dapibus, elit nisl convallis augue, eget
imperdiet velit ex vel nisl. Pellentesque feugiat libero sed felis pulvinar tempus. Suspendisse non
lacus ex. Quisque facilisis dolor augue, ac mollis est consequat non. Mauris sed libero vestibulum,
dignissim metus ut, bibendum leo. Praesent viverra sem eget imperdiet consequat. Vestibulum dapibus erat
eu elit ornare porta. Nunc tristique leo eget turpis luctus, sit amet lacinia odio elementum. Donec eget
dignissim quam, eleifend pharetra lorem. Sed aliquet molestie arcu mollis bibendum. Nullam efficitur
odio ut nibh euismod fermentum.
</p>
<p>
Vivamus laoreet ultrices orci, a cursus purus porttitor eget. Donec ut blandit turpis. Maecenas arcu
tellus, pretium et nibh sed, pulvinar tempor arcu. Cras tempor a risus a molestie. Vestibulum ante ipsum
primis in faucibus orci luctus et ultrices posuere cubilia curae; Etiam vitae massa neque. Integer vel
pretium tellus. Praesent in metus eget mauris porttitor faucibus. Donec aliquam, mi viverra rutrum
tempus, neque lorem luctus urna, a suscipit metus leo vitae quam. Integer vestibulum vulputate purus a
euismod.
</p>
<p>
Etiam vel magna felis. Donec sollicitudin condimentum ipsum, eu auctor dolor fermentum id. Pellentesque
tristique vitae lorem quis accumsan. Sed laoreet arcu sit amet varius fringilla. Class aptent taciti
sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed pellentesque rhoncus dolor,
vel molestie augue sollicitudin ut. Vestibulum in felis vitae nibh condimentum euismod. Suspendisse id
purus sapien. Vivamus sapien diam, iaculis vel massa sed, ultricies dignissim ligula. Fusce interdum non
massa ut lacinia. Mauris facilisis sodales faucibus. Sed hendrerit facilisis mi lobortis aliquam. Proin
ullamcorper erat pulvinar neque imperdiet, et tempor odio finibus. Vestibulum tortor nisl, venenatis
placerat odio at, commodo tincidunt diam.
</p>
</main>
</div>
</div>
</body>
</html>
I think what you're looking for is this. Just use w-100 on the main content so that it's forced to 100% width.
<div class="d-flex align-items-stretch vh-100 overflow-hidden ">
<nav>
<div id="sidebar" class="h-100 collapse width show">
<div class="h-100 d-flex flex-column p-2 text-white bg-dark" style="width: 280px;">
....
</div>
</div>
</nav>
<div class="flex-shrink-0 overflow-auto bg-light w-100">
<nav class="d-flex bg-white shadow-sm" style="--bs-breadcrumb-divider: '>';" aria-label="breadcrumb">
<button id="toggle-sidebar" class="btn ms-2 me-3 py-3" type="button" data-bs-toggle="collapse" data-bs-target="#sidebar" aria-expanded="true" aria-controls="sidebar">
<span class="bi bi-list"></span>
</button>
<ol class="breadcrumb mb-0 pt-3">
<li class="breadcrumb-item">
<a href="#">
<span class="bi bi-house-door-fill"></span> Home </a>
</li>
</ol>
</nav>
<main class="my-3 px-3">
<p> .... </p>
</main>
</div>
</div>
Demo
I am working on my portfolio page and as I was writing my html and my css, the site wasn't scrolling. I can't see the code only the first section.
Here is the html:
<navbar id="navbar">
<img id="logo" src="imagini/portfolio.png" alt="my portfolio" title="Bogdan's portfolio" />
<ul type="none" id="list">
<li>works</li>
<li>about</li>
<li>contact</li>
</ul>
</div>
<section id="welcome-section">
<h1>HI, I'M<br /> Pavel Bogdan Mihail</h1>
<p>I make people get amazed by my works because I'm AWSOME!</p>
<button type="button">GET IN TOUCH</button>
</section>
<section id="about">
<h3>A little bit about me</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean mollis neque sed massa sollicitudin interdum. Pellentesque vel libero sollicitudin lectus sollicitudin consectetur. In dictum eu nisi id porta. Ut molestie luctus hendrerit. Nulla ac nisl sit amet urna molestie dictum. Phasellus et turpis aliquet dolor iaculis congue. Nulla eget ligula nibh. Maecenas vel aliquam quam, sit amet semper nibh. Sed consectetur malesuada mauris a posuere. Suspendisse semper, magna ac convallis faucibus, orci eros ultrices diam, ac porttitor enim sem eget lorem. Proin laoreet commodo arcu, nec lobortis felis dapibus quis. Aenean ut arcu mauris. Nunc tempus erat eu felis faucibus facilisis. Donec gravida ullamcorper dolor ac dapibus. Sed pellentesque dapibus neque, quis ornare purus tincidunt ac.</p>
</section>
here is a codepen edit: https://codepen.io/bogdan-pavel/pen/pobgWjg
Your navbar is missing a closing tag. If you ad </navbar> after the navbar is done the rest will scroll.
Try this:
<navbar id="navbar">
<img id="logo" src="imagini/portfolio.png" alt="my portfolio" title="Bogdan's portfolio" />
<ul type="none" id="list">
<li>works</li>
<li>about</li>
<li>contact</li>
</ul>
</div>
<section id="welcome-section">
<h1>HI, I'M<br /> Pavel Bogdan Mihail</h1>
<p>I make people get amazed by my works because I'm AWSOME!</p>
<button type="button">GET IN TOUCH</button>
</section>
<section id="about">
<h3>A little bit about me</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean mollis neque sed massa sollicitudin interdum. Pellentesque vel libero sollicitudin lectus sollicitudin consectetur. In dictum eu nisi id porta. Ut molestie luctus hendrerit. Nulla ac nisl sit amet urna molestie dictum. Phasellus et turpis aliquet dolor iaculis congue. Nulla eget ligula nibh. Maecenas vel aliquam quam, sit amet semper nibh. Sed consectetur malesuada mauris a posuere. Suspendisse semper, magna ac convallis faucibus, orci eros ultrices diam, ac porttitor enim sem eget lorem. Proin laoreet commodo arcu, nec lobortis felis dapibus quis. Aenean ut arcu mauris. Nunc tempus erat eu felis faucibus facilisis. Donec gravida ullamcorper dolor ac dapibus. Sed pellentesque dapibus neque, quis ornare purus tincidunt ac.</p>
</section>
<navbar>
I'm just stuck, heres my codepen, what am I doing wrong?
http://codepen.io/lastnoob/pen/zvKNmo
</head>
<body>
<div class="ui left inverted vertical menu sidebar">
<div class="item">
<button id="hide-sidebar" class="button">
<i class="sidebar icon"></i>
</button>
</div>
<a class="item">
Item 1
</a>
<a class="item">
Item 2
</a>
<a class="item">
Item 3
</a>
</div>
<div class="pusher">
<div id="show-sidebar" class="button toggler">
<i class="sidebar icon"></i>
Sidebar
</div>
<!-- Site content !-->
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus</p>
</div>
</body>
</html>
JS:
$(function() {
$('#show-sidebar').click(function() {
$('#show-sidebar').hide();
$('.menu.sidebar').sidebar('toggle');
});
$('#hide-sidebar').click(function() {
$('#show-sidebar').show();
$('.menu.sidebar').sidebar('toggle');
});
});
It doesnt really do anything, my sidebar is not showing up, not doing anything.
i am making one slider tab, i know have tons of plugins for that but i don't want to use plugins. so i want to show my category post title and post like bellow html formate but i can't. i tried my but my way only content loop not title. if can able to make html like bellow then tabs will work. guys how can i do that.
<ul class="tabs">
<li>Tabs 1</li>
<li>Tabs 2</li>
<li>Tabs 3</li>
<li>Tabs 4</li>
<li>Tabs 5</li>
</ul>
so here under li (tabs) put post title
<div id="content_1" class="tab_view first_tab">
<h2>Tab #1</h2>
<p>Lorem ipsum dolor sit amet, duis netus ut posuere feugiat arcu, purus wisi quis fringilla at, nunc ut eget elit duis erat praesent, ut fermentum lacus turpis cras. Justo gravida erat quam mauris purus, aliquam quisque, eget nisl. Pellentesque nibh duis odio morbi quam, scelerisque convallis aenean quam tincidunt ornare nam nec feugiat sodales tristique.</p>
</div>
<div id="content_1" class="tab_view first_tab">
<h2>Horizontal Tab #1</h2>
<p>Lorem ipsum dolor sit amet, duis netus ut posuere feugiat arcu, purus wisi quis fringilla at, nunc ut eget elit duis erat praesent, ut fermentum lacus turpis cras. Justo gravida erat quam mauris purus, aliquam quisque, eget nisl. Pellentesque nibh duis odio morbi quam, scelerisque convallis aenean quam tincidunt ornare nam nec feugiat sodales tristique.</p>
</div>
<div id="content_1" class="tab_view first_tab">
<h2>Horizontal Tab #1</h2>
<p>Lorem ipsum dolor sit amet, duis netus ut posuere feugiat arcu, purus wisi quis fringilla at, nunc ut eget elit duis erat praesent, ut fermentum lacus turpis cras. Justo gravida erat quam mauris purus, aliquam quisque, eget nisl. Pellentesque nibh duis odio morbi quam, scelerisque convallis aenean quam tincidunt ornare nam nec feugiat sodales tristique.</p>
</div>
<div id="content_1" class="tab_view first_tab">
<h2>Horizontal Tab #1</h2>
<p>Lorem ipsum dolor sit amet, duis netus ut posuere feugiat arcu, purus wisi quis fringilla at, nunc ut eget elit duis erat praesent, ut fermentum lacus turpis cras. Justo gravida erat quam mauris purus, aliquam quisque, eget nisl. Pellentesque nibh duis odio morbi quam, scelerisque convallis aenean quam tincidunt ornare nam nec feugiat sodales tristique.</p>
</div><div id="content_1" class="tab_view first_tab">
<h2>Horizontal Tab #1</h2>
<p>Lorem ipsum dolor sit amet, duis netus ut posuere feugiat arcu, purus wisi quis fringilla at, nunc ut eget elit duis erat praesent, ut fermentum lacus turpis cras. Justo gravida erat quam mauris purus, aliquam quisque, eget nisl. Pellentesque nibh duis odio morbi quam, scelerisque convallis aenean quam tincidunt ornare nam nec feugiat sodales tristique.</p>
</div>
see closely href="#content_1" rel="tab_1" this #content_ (1,2,3,4,5)should auto. similar <div id="content_1" this content_ also number will auto i mean post number
You can try this
$args = array(
'post_type' => array('post'),
'orderby' => 'post_date',
'category_name'=>'my category name' ,
'showposts' => 5 );
$array= get_posts($args); ?>
<ul class="tabs">
for ($i = 0; $i < count($array); $i++) { ?>
<li><a href="#content_<?php echo $i+1; ?>" rel="tab_<?php echo $i+1; ?>" class="tab">Tabs
<?php echo $i+1; ?></a></li>
<?php
$divs.='<div id="content_'.($i+1).'" class="tab_view first_tab">
<h2>'.$array[$i]->post_title.'</h2>
<p>'.$array[$i]->post_content.'</p>
</div>';
} ?>
</ul>
<?php $divs; ?>
I'm using the 1140 grid system and have a basic question: Do you need to use empty divs as "spacers" if you want an element to be less than 12 cols wide?
Here's the mockup I'm looking to achieve:
Basically, I want to footer to be only underneath the primary area, but in its own row. The only way I can see to do this is to use a div as a "spacer" to indent the footer to where I want it. Is this how its done?
Here's the code (you'll need to make the preview screen large to see what's going on): http://jsfiddle.net/saltcod/87DZC/
<link rel="stylesheet" href="https://raw.github.com/robertcedwards/HTML-5-Boilerplate-1140-Grid/master/css/1140.css" type="text/css" media="screen" />
<div id="main">
<h1 class="site-title">Site Title</h1>
<div class="container">
<div class="row">
<div id="sidebar" class="threecol">
<h4> Sidebar - Three cols</h4>
<ul>
<li> Item one</li>
<li> Item two</li>
<li> Item three</li>
<li> Item four</li>
<li> Item five</li>
</div>
<div id="primary" class="ninecol last">
<h3>Nine columns</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse vel lectus non nisi pellentesque porta sed vel ante. Aliquam ut elit nulla, ac fermentum diam. Donec convallis dui in felis bibendum mollis. Quisque egestas purus libero, ac vehicula tortor. Sed tristique est sed libero pulvinar nec luctus metus vulputate. Etiam ac tempor nunc. Morbi sit amet neque lacus, ac lacinia nisl. Nullam imperdiet ornare sem, non viverra ipsum hendrerit id. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras vel leo nisl. Ut bibendum ornare urna eget lacinia.</p>
<p>Aliquam ante lectus, ornare a sollicitudin tincidunt, convallis a magna. Sed fermentum lacus id nisl vestibulum interdum. Ut mattis justo in mi vulputate porttitor. Proin sagittis, urna quis blandit semper, velit nisi aliquet dui, et placerat leo purus a erat. Donec congue, elit a eleifend facilisis, lectus sapien placerat augue, in feugiat ante purus sodales libero. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean eget lacus sed enim euismod faucibus. Pellentesque facilisis arcu sed leo gravida a ultricies nisi cursus. Quisque venenatis mollis ligula sed semper. Nullam ac sem purus, non tincidunt velit. In hendrerit, odio sit amet tempus pharetra, libero orci suscipit tellus, eu mollis augue dui a nulla. Vivamus dignissim elit sit amet est mollis sed aliquet lorem posuere. Nulla varius purus quis elit pellentesque et auctor nunc gravida. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed nibh erat, aliquet a luctus vel, pulvinar nec neque.</p>
<h2> If I want three blocks inside #primary, that's easy: </h2>
<div class="fourcol bottom">A</div>
<div class="fourcol bottom">B</div>
<div class="fourcol bottom last">C</div>
</div> <!-- [ .row ] -->
<footer class="row twelvecol">
<h3> But if I want three blocks in my footer, I need to 'indent' it with an empty div?</h3>
<div class="threecol empty bottom"> [ empty div ]</div>
<div class="threecol bottom">A</div>
<div class="threecol bottom">B</div>
<div class="threecol bottom last">C</div>
<p> Isn't this a bit like using a spacer gif in a table layout? </p>
</footer>
</div>
</div>
Isn't this a bit like using a spacer gif in a table layout?
Yes essentially the div will create the space you intended it to make. When using CSS grid frameworks, it's common to use empty divs with the appropriate column class in order to space things accordingly. Of course you can come up with alternate solutions involving relative positioning, etc, but why complicate matters. The last bit of code should look something like this.
<footer class="row twelvecol">
<div class="threecol first"></div>
<div class="threecol bottom">A</div>
<div class="threecol bottom">B</div>
<div class="threecol bottom last">C</div>
</footer>