Jump to content

Recommended Posts

Posted

I am trying to figure out how to get a page that can pull summaries from other pages that are part of a certain section. These would automatically pull the latest ones as they are created. This would be used in something similar to a newspaper/magazine style site. Right now I am using <?php $firstsummary = $pages->get("parent=$page, sort=date"); echo $firstsummary->summary;?> to pull the first one, but I do not know how to do some sort of offset. I am not thinking about using a loop, because some of the html will be different depending on where it is on the page. Any pointers in the right direction could be helpful. I am rather interested in ProcessWire and am coming from doing textpattern stuff and once in a while wordpress sites.

Posted

Hi joyfulcode,

To do an offset I think you could just add "start=n" right after you've got "sort=date" where n is the number of items to offset (though this attribute is a bit hard to find; even using the cheatsheet search). Using the example from the docs:

<ul><?php
$moreitems = $page->children("sort=date, start=3");
foreach ($moreitems as $item)
echo "<li><a href='{$item->url}'>{$item->title}</a></li>";
?>
</ul>
  • Like 2
Posted

Hi joyfulcode and welcome to the forums!

Have you yet read http://processwire.com/api/selectors/? It has pretty good examples how to get other pages.

If you provide more information how your site is build (site tree, templates used), what data you need and where I am sure we can provide better answers for you.

Posted

Thank you everyone. I somehow missed the start portion in selectors. Right now I do not have a site created per say, but am doing a few exercises of incorporating process wire into basic css templates to see how it all works. I was able to get it all working with test data. Really starting to like this CMS, the fields part really makes this compelling to use. I have played with drupal and it took me way too long to build a decent site, while this has taken me very little time to get it to move in the direction I need it to. I look forward to being able to play with the repeating fields stuff when that is released.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...