Page 1 of 2
[SOLVED] CGSimpleSmarty help with nested pages (replacement
Posted: Mon Jul 07, 2008 12:05 am
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.
Re: [SOLVED] CGSimpleSmarty help with nested pages (replacem
Posted: Mon Jul 07, 2008 12:52 am
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.
Re: [SOLVED] CGSimpleSmarty help with nested pages (replacement for Page Blocks)
Posted: Sun Jul 20, 2008 12:19 pm
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
Re: [SOLVED] CGSimpleSmarty help with nested pages (replacement for Page Blocks)
Posted: Tue Jul 22, 2008 12:02 pm
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?
Re: [SOLVED] CGSimpleSmarty help with nested pages (replacement for Page Blocks)
Posted: Wed Jul 23, 2008 12:01 am
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.
Re: [SOLVED] CGSimpleSmarty help with nested pages (replacement for Page Blocks)
Posted: Wed Jul 23, 2008 9:01 am
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.
Re: [SOLVED] CGSimpleSmarty help with nested pages (replacement for Page Blocks)
Posted: Mon Aug 11, 2008 4:48 pm
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.
Re: [SOLVED] CGSimpleSmarty help with nested pages (replacement for Page Blocks)
Posted: Mon Aug 11, 2008 5:13 pm
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.
Re: [SOLVED] CGSimpleSmarty help with nested pages (replacement for Page Blocks)
Posted: Mon Aug 11, 2008 7:53 pm
by Dr.CSS
I've heard that Page Blocks still work...
Re: [SOLVED] CGSimpleSmarty help with nested pages (replacement for Page Blocks)
Posted: Mon Aug 11, 2008 8:03 pm
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.
Re: [SOLVED] CGSimpleSmarty help with nested pages (replacement for Page Blocks)
Posted: Wed Aug 13, 2008 1:37 pm
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.
Re: [SOLVED] CGSimpleSmarty help with nested pages (replacement for Page Blocks)
Posted: Thu Aug 14, 2008 5:54 pm
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
Re: [SOLVED] CGSimpleSmarty help with nested pages (replacement for Page Blocks)
Posted: Thu Aug 14, 2008 6:58 pm
by jubasolo
Re: [SOLVED] CGSimpleSmarty help with nested pages (replacement for Page Blocks)
Posted: Sun Oct 12, 2008 9:08 am
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
Re: [SOLVED] CGSimpleSmarty help with nested pages (replacement for Page Blocks)
Posted: Tue Oct 14, 2008 8:55 am
by Dr.CSS
@denli
You may want to delete this and start a new thread for your problem...