Search the Community
Showing results for tags 'first'.
-
Is there any way to limit the text just to the first paragraph of the body lets say? Thanks very much guys.
-
I've been trying to make a carousel with a repeater field that has an "active" class on the first div. I found a similar thread here but still can't get it to work. Most likely me having a dumb moment Here's my code: <div class="carousel slide <?=$page->position?>"> <h4><?=$page->heading?></h4> <!-- Carousel items --> <div class="carousel-inner"> <?php $output = ''; $class = 'item'; foreach($page->testimonials as $testimonial) { $status = ''; if ($testimonial === $page->testimonials->first()) $status .= ' active'; $class .= $status; $output .= "<div class='{$class}'> <img class='quotes' src='{$config->urls->templates}assets/img/quotes.png'> <p>{$testimonial->body}</p> <h6>{$testimonial->person_name}</h6> </div>"; } echo $output; ?> </div> </div> Any ideas where I'm going wrong?
-
I was wondering how to achieve the following. A total of 100 pages which are listed with a limit of 10 items per page, resulting in 10 pages of 10 items. Instead i desire the following (below), and wondering how to setup the code / selector(s). The first page should show a list of 8 items. After that all following pages should have a limit of 10 items. page 1 -> items 1 - 8 -> (limit 8) page 2 -> items 9 - 18 -> (limit 10) page 3 -> items 19 - 28 -> (limit 10) ... page 9 -> items 79 - 88 -> (limit 10) page 10 -> items 89 - 98 -> (limit 10) page 11 -> items 98 - 100 -> (limit 10) The ideal situation would be to have an extra page selector property aside of 'limit', something named 'limit_first' or alike.
-
Hi folks, I'm set up a simple next/prev between pages that are loaded in via pjax with the following: <?php if ($page->next->id) : ?> <div class="next-solution-container"> <a data-pjax class="next-solution" href="<?php echo $page->next->url; ?>"><span><?php echo $page->next->title; ?></span></a> </div> <?php endif; ?> This worked great, but I want it now to loop... so if it's the last item, it gets the first item as the next link. I thought the following below would work, but as I am using it on the page template, and thus using $page, I don't think first/last are in use? <?php if ($page == $page->last) : ?> <div class="next-solution-container"> <a data-pjax class="next-solution" href="<?php echo $page->first->url; ?>"><span><?php echo $page->first->title; ?></span></a> </div> <?php else : ?> <div class="next-solution-container"> <a data-pjax class="next-solution" href="<?php echo $page->next->url; ?>"><span><?php echo $page->next->title; ?></span></a> </div> <?php endif; ?> Any thoughts?
- 7 replies
-
- pagination
- last
-
(and 3 more)
Tagged with:
-
I want to resize an image that is included in a selected featured project as referenced from a Home page. The "Featured Project" field found on the Home page is using a Page type. The "Images" field included in the "Featured Project" is a repeater field that includes an Image field. How do I access the first image in the "Images" field and also resize the image? This works and returns the ID of the image: $img = $page->featured_project->images->first(); but this doesn't work to resize the image: $img = $page->featured_project->images->first(); $thumbnail = $img->size(236,225); Nor does this: $img = $page->featured_project->images->first()->size(236,225); Any insight is appreciated!
-
I'm trying to switch from using jQuery cycle to the Twitter Bootstrap carousel and it requires the first item to have a class of "active". Sounds easy enough but doesn't seem to be working. My test is true every time and every item gets the "active" class appended to it. Any ideas where I'm going wrong? <div class="span4 offset1"> <div id="galleries" class="carousel slide"> <!-- Carousel items --> <div class="carousel-inner"> <?php $galleries = $pages->find("template=gallery, sort=-created, limit=3"); $class = "item"; foreach ($galleries as $gallery) { if ($gallery === $galleries->first()) { $class .= " active"; } ?> <div class="<?php echo $class; ?>"> <a href="<?php echo $gallery->url; ?>"> <img src="<?php echo $gallery->images->first()->url; ?>" alt="" /> <h6><?php echo $gallery->title; ?></h6> </a> </div> <?php } ?> </div> <!-- Carousel nav --> <a class="carousel-control left" href="#galleries" data-slide="prev">‹</a> <a class="carousel-control right" href="#galleries" data-slide="next">›</a> </div> </div> Funny as when i try with last() the class is applied correctly...