Page 1 of 1

Create a one page site with the reorderable content

Posted: Tue Apr 23, 2013 9:59 am
by manuel
Dear All,

A quick example demonstrating what smarty building blocks are needed to grab the content of all pages for a certain level and show them on one page.
The advantages:
- only cgsimplesmarty module is needed (you could also replace this with a UDT if you don't want to install any modules at all)
- easy to re-order the content of the page by simple re-ordering the pages.

First, create a menu template "test":

Code: Select all

{foreach from=$nodelist item=i name=n}{$i->alias}{if !$smarty.foreach.n.last},{/if}{/foreach}
Then in your page template, paste the following code to get you started:

Code: Select all

{menu template='test' number_of_levels='1' assign='somevar'}
{$somevar}
{assign var=somearray value=","|explode:$somevar}
{$somearray|print_r}
{foreach from=$somearray item=i}
{cgsimple::get_page_content("$i")}
{/foreach}
You can expand on this, grabbing the page titles and other elements, alternate css styles in the foreach, ...

As said, this is just to get you started :)

Greetings,
Manuel