GetSimple Support Forum

Full Version: Displaying child pages on the same page as parent
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi. I'm considering using GetSimple for a site. Let's imagine I have a navigation structure like so:

- Home page
-- Sub page 1
-- Sub page 2
-- Sub page 3
- Another page
-- Another sub page 1
-- Another sub page 2
-- Another sub page 3

What I want to do, is use GetSimple to generate links for pages Home page and Another page, and then display those pages together with their children. For example, when the user goes to the home page, they would see the content of the home page, but also divs with the content of sub page 1, sub page 2 and sub page 3 below it, like so:

[Image: 18-05-05.png]

Would this be at all possible with GetSimple? I'd imagine it would have to be a bit like the WordPress loop, where on every parent the children are looped and displayed in a div, but I've never used GetSimple before, so I don't really know what is possible.
Here. You want to check out getChildrenMulti() where "options" are actually the fields with data that you want to have returned. This function also works with custom fields added by other plugins like the "I18N Custom Fields" plugin.
That looks like it could work perfectly Smile From my understanding of WordPress (the two seem similar), I understand I'd be using that on the template page?
Can be done using the I18N plugin. I think that the Child Menu plugin would work too (but it doesn't support all types of permalink structures AFAIK)

You could also use something like this in your template:

PHP Code:
<?php foreach (getChildren(return_page_slug()) as $child): ?>
 <a href="<?php echo find_url($childreturn_page_slug()); ?>"><?php getPageField($child'title'); ?></a>
 <br />
<?php endforeach; ?>
not menu, content.

working code for this is actually posted somewhere in the forum I believe.
oops

so something like this?
PHP Code:
<?php foreach (getChildren(return_page_slug()) as $child): ?>
  <div class="subpage">
   <?php getPageContent($child); ?>
  </div>
<?php endforeach; ?>
yes or something like
not sure if this returns a assoc array or not
PHP Code:
$page get_page_slug(false);
foreach(
getChildrenMulti($page,array('content'))) as $key=>$value){
echo 
$value;



although i would use a plugin like custom fields or something since files have to be loaded for each content as page cache is not used.
idea for plugin that adds content to pages.xml for small sites that use pages like this.
Ill probably just add this to core though as an option to cacheall

carlos, does that template syntax work in php 5.2 ?
I think that syntax is available since PHP 4.