sakkoulas Posted February 3, 2013 Posted February 3, 2013 hi again, can anyone help me please because my mind will explode..i have a page with children and i want to create a bootstrap slider with the last 5 page->children that have a specific field page tag.so i have stuck with this ... <?php $i = 1; $tax = $pages->find("template=taxonomy, title=1293|1292"); $slider = $pages->get("/last-news/")->children("$tax, limit=5"); foreach ($slider as $s){ $thumb = $s->images->first(); $activeClass= ''; if ($i === 1) $activeClass = 'active'; echo "<div class='item $activeClass'> <img src='{$thumb}' alt='$s->description'> <div class='carousel-caption'> <h4>Second Thumbnail label</h4> <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p> </div> </div>"; $i++; } ?> this code returns1 imageand 4 empty images src thanks
diogo Posted February 3, 2013 Posted February 3, 2013 I don't understand this part of your code children("$tax, limit=5") Maybe you mean children("some-pagefield=$tax, limit=5")
JeffS Posted February 4, 2013 Posted February 4, 2013 Here is an example function to render a bootstrap carousel. Using a repeater field called slider with title and image fields assigned. The image->summary is used for the optional caption. Also added a checkbox field to control the display called slider_visible. This should get you going. EDITED - moved source to gist. https://gist.github.com/netdoctor/b6f3694c6c472084d467
ryan Posted February 5, 2013 Posted February 5, 2013 $tax = $pages->find("template=taxonomy, title=1293|1292"); I'm confused about the line above, because the 'title' is numbers like you would usually see as a page ID. Can you confirm that your page titles literally are these numbers? <img src='{$thumb}' alt='$s->description'> The above line should instead be this: <img src='$thumb->url' alt='$thumb->description' />
sakkoulas Posted February 6, 2013 Author Posted February 6, 2013 Thanks guys ... sorry for the delay, i have figured out, is the first time I use filters ..and already like the way it works
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now