[SOLVED] CGSimpleSmarty help with nested pages (replacement

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
spod_dmd
Forum Members
Forum Members
Posts: 25
Joined: Fri Oct 26, 2007 2:56 am

[SOLVED] CGSimpleSmarty help with nested pages (replacement

Post by spod_dmd »

Hi

The Page Blocks module has been discontinued in favour of using actual pages and page templates and CGSimpleSmarty module to emulate Page Blocks. (see: http://forum.cmsmadesimple.org/index.ph ... 988.0.html)

It's great, it means that page blocks and the page structure are all kept together with the benefit of a clean and clear page structure and the ability to move page Block positions.

I have successfully replaced Page Blocks on all my pages except one where there is a need for nested page blocks. It all works except for the third level page (the Page Block nested within a Page Block) where only the actual {content} content shows up but {content block="Publication logo"} does not.

Here are snippets of the code used in the 3 templates that list Page Blocks of publications categories and then Page Blocks of the publications within these categories:

TOP LEVEL (main Publications page):

Code: Select all

{content}

{foreach from=$cgsimple->get_children('','',$children) item='child'}
 {$cgsimple->get_page_content($child.alias)}	
  {foreach from=$cgsimple->get_children($child.alias,'',$subchildren) item='subchild'}					
  {$cgsimple->get_page_content($subchild.alias,'Publication logo')}
   {$cgsimple->get_page_content($subchild.alias)}
  {/foreach}		
{/foreach}
SECOND LEVEL (repeating 'Publications Categories'):

{content}

THIRD LEVEL (repeating 'Publications' for each 'Publications Category'):

{content block="Publication logo"}
{content}


Can anyone see where I'm going wrong? Is it possible to nest "Page Blocks" using this method?

Any help appreciated.

Thanks.
Last edited by spod_dmd on Mon Jul 07, 2008 1:03 am, edited 1 time in total.
spod_dmd
Forum Members
Forum Members
Posts: 25
Joined: Fri Oct 26, 2007 2:56 am

Re: [SOLVED] CGSimpleSmarty help with nested pages (replacem

Post by spod_dmd »

Hi All

Solved it myself.

Rather than use the actual content block name 'Publication logo' from {content block="Publication logo"} I used the way it appears in the 'prop_name' column of the 'cms_content_props' table of the database which was the name of the block with all spaces replaced by an under score e.g. 'Publication_logo'.

So:
{$cgsimple->get_page_content($subchild.alias,'Publication logo')}

...should read:

{$cgsimple->get_page_content($subchild.alias,'Publication_logo')}

...note the addition of the underscore, that's the only change.

So, yes, nesting Page Blocks using this method works just great if you remember this one small quirk.
denli
Forum Members
Forum Members
Posts: 86
Joined: Tue Sep 04, 2007 12:26 pm

Re: [SOLVED] CGSimpleSmarty help with nested pages (replacement for Page Blocks)

Post by denli »

Your a live saver!
thanks a lot was looking for this answer.
Thanks to Applejack for pointing this one out to me!

dejo
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am
Location: London

Re: [SOLVED] CGSimpleSmarty help with nested pages (replacement for Page Blocks)

Post by applejack »

Hi spod_dmd

Thanks very useful tip. Now I don't suppose you have tried randomising the output. What I am looking to do is say that their are 10 child arrays but at any one time you just want to show 3 but have these randomised?

Website Design & Production
http://www.applejack.co.uk
spod_dmd
Forum Members
Forum Members
Posts: 25
Joined: Fri Oct 26, 2007 2:56 am

Re: [SOLVED] CGSimpleSmarty help with nested pages (replacement for Page Blocks)

Post by spod_dmd »

Oh now you're getting tricky!

No I haven't tried this yet but, off the top of my head, if I did I think I'd probably create a User Defined Tag to generate the random IDs and use the UDT in conjunction with the template (or something like that!).

I will try and have a go when I have some time and see what happens.
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am
Location: London

Re: [SOLVED] CGSimpleSmarty help with nested pages (replacement for Page Blocks)

Post by applejack »

Hi spod_dmd

Would be useful to have though. I am a Perl programmer so I don't really know much PHP or Smarty so I am unsure of some of the syntax etc Hope you manage to crack it I would be very interested.

I look forward to hearing from you.

Website Design & Production
http://www.applejack.co.uk
streever

Re: [SOLVED] CGSimpleSmarty help with nested pages (replacement for Page Blocks)

Post by streever »

I keep hearing this is a replacement for pageblocks, but is it really? I dropped in the code & it seems to just pull in the child pages..... which isn't at all what people are describing, so I am imagining I am doing something wrong.
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am
Location: London

Re: [SOLVED] CGSimpleSmarty help with nested pages (replacement for Page Blocks)

Post by applejack »

Nope that is exactly what it does i.e. pull in content from child pages from which you can choose which content blocks title etc what you want to use. This makes it very powerful as you can reuse content separated from formatting anywhere.

However I don't see this as an adequate replacement for Page Blocks for the very reason that it doesn't contain formatting as this is very much orientated to techie use not for a client.

Therefore I think unless something better comes along Page Blocks should continue. There is also an issue with integrating cgisimple content with the search engine as it doesn't find content in relation to its context.

Website Design & Production
http://www.applejack.co.uk
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: [SOLVED] CGSimpleSmarty help with nested pages (replacement for Page Blocks)

Post by Dr.CSS »

I've heard that Page Blocks still work...
streever

Re: [SOLVED] CGSimpleSmarty help with nested pages (replacement for Page Blocks)

Post by streever »

They do!
They stopped working on one site of mine, and reading Elijah's comments, I thought he was not discontinuing them--i.e. getting rid of them.
mathieu.bautista
Forum Members
Forum Members
Posts: 10
Joined: Wed Aug 13, 2008 8:42 am

Re: [SOLVED] CGSimpleSmarty help with nested pages (replacement for Page Blocks)

Post by mathieu.bautista »

Hi,

???...Errrr.... Sorry, but my experience is PageBlocks 0.1.5 does NOT work with the CMSMS 1.4.1 using Apache 2 and PHP 5...

Here is the bug I found : http://forum.cmsmadesimple.org/index.php/topic,24694.0.html

Anyway, it seems a better solution to use "CGSimply" (not sure it's the right name...) because it seems to use the page content tree to construct blocks... (that's what I do with Typo3), instead of using a "special" type of content.

Right now I am going back to use Typo3 because i don't have the time to reinstall CMSMS and try cgsimply, but I will probably try CMSMS for the next site I have to create. Note that Typo3 is not bad, but it is way too much complicated... :-\

I also had a question : why are you using a table layout (tables, tr, td...) with dirty html attributes (align...) instead of using a div layout and a css stylesheet ? Optimizing the smarty code is important, but don't forget to optimize your HTML/CSS code too !  ;)

See you.
jubasolo
Forum Members
Forum Members
Posts: 19
Joined: Wed Aug 13, 2008 3:09 pm

Re: [SOLVED] CGSimpleSmarty help with nested pages (replacement for Page Blocks)

Post by jubasolo »

Hi, Mathieu

try if it works in English!

It seems to me it works in English, but in no other language.

I have notified Ted of the problem, since Elijah has withdrawn.

Perhaps Page Blocks is going to be discontinued. It would be a pity though. I like that module very much. But maybe they come up with something even better.

Jonathan
jubasolo
Forum Members
Forum Members
Posts: 19
Joined: Wed Aug 13, 2008 3:09 pm

Re: [SOLVED] CGSimpleSmarty help with nested pages (replacement for Page Blocks)

Post by jubasolo »

Also take a look at my final / temporary solution:

http://forum.cmsmadesimple.org/index.ph ... #msg120417
denli
Forum Members
Forum Members
Posts: 86
Joined: Tue Sep 04, 2007 12:26 pm

Re: [SOLVED] CGSimpleSmarty help with nested pages (replacement for Page Blocks)

Post by denli »

Hi all

I hope someone can help me with this one!

Is it posible to point a specific page/template to get te content from and if its empty that it doesn't create a empty div or table?

I am using 2 different field of content and they got a different setup. But now when I create a page both content fields create a new div with this new page-block trick, one got the content I entered but the other a empty div because it uses different names for the content blocks (input fields).

Hope someone can help!

thanks
Denli
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: [SOLVED] CGSimpleSmarty help with nested pages (replacement for Page Blocks)

Post by Dr.CSS »

@denli

You may want to delete this and start a new thread for your problem...
Locked

Return to “Modules/Add-Ons”