Create a one page site with the reorderable content

Do something cool with CMS? Show us ...
This board is for 'Answers', and the discussion of answers... Not for questions.
Post Reply
User avatar
manuel
Power Poster
Power Poster
Posts: 353
Joined: Fri Nov 30, 2007 9:15 am

Create a one page site with the reorderable content

Post 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
Do you like your open source cms? Buy from the CMSMS partners || Donate
Post Reply

Return to “Tips and Tricks”