GetSimple Support Forum

Full Version: How to iterate on children and show fields?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am setting up an extremely simple portfolio view. What I want to do is something like this:

Code:
// Main portfolio page -- simple example without html formatting

foreach ($page->children as $child) {
    echo $child->title;
    echo $child->article_image; //i18n custom field name
}

How can I get the child pages in that sort of way? That's how I normally do it in a different CMS, so I hope I can do this with GetSimple. Thanks!
very similar...

Code:
foreach (getChildren($page) as $child){
echo getPageField($child,'title');
echo getPageField($child,article_image);
}
Very nice. Thanks for the quick reply.
or you could also use getChildrenMulti which should be a bit faster.

Code:
$children=getChildrenMulti($page,array('title','article_image'));
foreach ($children as $child){
echo $child['title'];
echo $child['article_image];
}
Great, this is going on a budget host so the speed tips are appreciated. Thank you.

I did have a question though--if I do something like this for an articles section, is there a modular way to add pagination (list pagination)? Or should I use some sort of blog plugin?
You should check Mvlcek's plugin, as his "special pages" plug will make it easier to maintain articles of same type.
There are also a blog plugins.