Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
One-Page-Template-> automatically include new pages in a div
#25
This is my variation of the Carlos script, tweaked to outputs only pages that are children of the current page and non-private. So pages can be automatically built from it's child-pages. Works fine for me, I use menu order for sorting and once the order is OK turn off "show in menu" to hide those pages from the nav menu.

PHP Code:
<?php
    
global $pagesArray
    
$pagesSorted subval_sort($pagesArray,'menuOrder'); // or 'title', 'menu', 'url', ...
    
$thisPage return_page_slug(); 
    
    foreach (
$pagesSorted as $page) if ($page['parent']==$thisPage && $page['private']!='Y') {
        
$pag $page['url']; ?>
        <article class="subpage">
        <a id="<?php echo $pag?>"></a>
            <h2><?php getPageField($pag,'title'); ?></h2>
        <div class="subcontent">
            <?php getPageContent($pag); ?>
        </div>
    </article>
        <?php ?>

I assume that the global "pagesarray" is the GS cache?
I wonder if it is possible to use GetChildern or GetChildrenMulti to do the same.
If so, which is more efficent for the server, or does it all happen via the cache anyway?

I have been using GS for a couple of years now, and I should say, it's the first CMS I actually enjoy theme-ing/templating.
Reply


Messages In This Thread
RE: One-Page-Template-> automatically include new pages in a div - by lesh - 2014-11-19, 23:08:12



Users browsing this thread: 2 Guest(s)