Jump to content

sakkoulas

Members
  • Posts

    122
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by sakkoulas

  1. 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 returns 1 image and 4 empty images src thanks
  2. This works also for me, thanks
  3. now it s working, i just change the echo "<li> <a href='{$item->name}' data-toggle='tab'> {$item->title} </a></li>"; to echo "<li> <a href='#{$item->name}' data-toggle='tab'> {$item->title} </a></li>"; thanks guys
  4. <ul class="nav nav-tabs" id="myTab"> <?php foreach ($page->children as $item){ echo "<li> <a href='{$item->name}' data-toggle='tab'> {$item->title} </a></li>"; }?> </ul> <div class="tab-content"> <?php $i = 1; $activeClass = ''; foreach ($page->children as $item){ if ($i == 1) $activeClass = ' active'; echo "<div class='tab-pane $activeClass' id='{$item->name}'>{$item->body}</div>"; $i++; } ?> </div>
  5. Thanks for the quick response, but confuses me the $i if i do it as you say then it shows me all the $page->body with the class active; sorry for my questions but I am new to Php
  6. Hi, I'm a totally new user of ProcessWire and i need some help with bootsrap framework i wan to create a bootsrap tab that dynamicaly gets page-> children titles and bodys to bootsrap tab i have this but it is not working can anyone help me. thanks <ul class="nav nav-tabs" id="myTab"> <?php foreach ($page->children as $item){ echo "<li> <a href='{$item->name}'> {$item->title} </a></li>"; }?> </ul> <div class="tab-content"> <?php foreach ($page->children as $item){ echo "<div class='tab-pane' id='{$item->name}'>{$item->body}</div>"; }?> </div>
×
×
  • Create New...