GetSimple Support Forum
Can one page gets content dynamically from others? - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: General Questions and Problems (http://get-simple.info/forums/forumdisplay.php?fid=16)
+--- Thread: Can one page gets content dynamically from others? (/showthread.php?tid=3320)



Can one page gets content dynamically from others? - YNTs - 2012-06-29

Hello. I have site in PHP and try to move it to GS.

My index.php founds files and adds content from them to itself:
<?php
$files = glob( 'tariffs/tariff*.php' );
foreach( $files as $file ) {
include( $file );
echo $tariff_about;
}
;?>

But in GetSimple there is no separate *.php files as I add content to GS, so I cant use this peace of code.

I want to know is there a way to create same behaviour with GS? I mean that main page dynamically is being got content from some pages (I found a plugin here to add custom page types).


Can one page gets content dynamically from others? - yojoe - 2012-06-29

Of course there is! GS operates on xml files, thus you have to use appropriate methods to work on them.
Search for excerpt plugin in extend and look into its source code. It will give you an insight of how to work with GS xml content files.

Mayb in GS wiki you will find something useful too.


Can one page gets content dynamically from others? - jay_m - 2012-07-03

You could do something like this
Code:
<?php $items = getChildren(return_page_slug());?>
            
                <?php foreach($items as $item): ?>    
                     <div class="col">
                     <?php echoPageContent($item); ?>
                    </div>
                <?php endforeach;?>

Create the pages that you want to include on your main page as child pages and the above code will display the child page content in the main page.

You could also install the Custom Fields plugin and pull only certain fields using
Code:
<?php echoPageField($item, CUSTOMFIELD); ?>



Can one page gets content dynamically from others? - YNTs - 2012-07-03

jay_m Wrote:You could do something like this…
Thanks a lot, I'll try.