Welcome, Guest. Please login or register.
Did you miss your activation email?
16 Mar 2010, 13:20

Login with username, password and session length
Home Chat Help Search Calendar Login Register
Pages: [1] 2
Print
Author Topic: [SOLVED] CGSimpleSmarty help with nested pages (replacement for Page Blocks)  (Read 3177 times)
0 Members and 1 Guest are viewing this topic.
spod_dmd
Forum Members
**

Karma: 0
Offline Offline

Posts: 25


« on: 06 Jul 2008, 20:05 »

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.php/topic,22988.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):

<td width="100%" align="left" valign="top" class="text">{content}<br />
      {foreach from=$cgsimple->get_children('','',$children) item='child'}
         {$cgsimple->get_page_content($child.alias)}   
         {foreach from=$cgsimple->get_children($child.alias,'',$subchildren) item='subchild'}
         <table border="0" cellpadding="5" cellspacing="0" width="100%">
            <tbody>
               <tr>
                  <td align="center" valign="top">{$cgsimple->get_page_content($subchild.alias,'Publication logo')}</td>
                  <td class="text" align="left" valign="top" width="100%">{$cgsimple->get_page_content($subchild.alias)}</td>
               </tr>
            </tbody>
         </table>
         {/foreach}      
      {/foreach}</td>

SECOND LEVEL (repeating 'Publications Categories'):

<span class="publicationhead">{content}<br /><div class="ruledashes"></div></span>

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

<table border="0" cellpadding="5" cellspacing="0" width="100%">
   <tbody>
      <tr>
         <td align="center" valign="top">{content block="Publication logo"}</td>
         <td class="text" align="left" valign="top" width="100%">{content}</td>
      </tr>
   </tbody>
</table>

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

Any help appreciated.

Thanks.
« Last Edit: 06 Jul 2008, 21:03 by spod_dmd » Logged
spod_dmd
Forum Members
**

Karma: 0
Offline Offline

Posts: 25


« Reply #1 on: 06 Jul 2008, 20:52 »

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:

<td align="center" valign="top">{$cgsimple->get_page_content($subchild.alias,'Publication logo')}</td>

...should read:

<td align="center" valign="top">{$cgsimple->get_page_content($subchild.alias,'Publication_logo')}</td>

...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.

Logged
denli
Forum Members
**

Karma: 0
Offline Offline

Posts: 46


« Reply #2 on: 20 Jul 2008, 08:19 »

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

dejo
Logged
applejack
Power Poster
***

Karma: 0
Offline Offline

Posts: 254


« Reply #3 on: 22 Jul 2008, 08:02 »

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?
Logged
spod_dmd
Forum Members
**

Karma: 0
Offline Offline

Posts: 25


« Reply #4 on: 22 Jul 2008, 20:01 »

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.

Logged
applejack
Power Poster
***

Karma: 0
Offline Offline

Posts: 254


« Reply #5 on: 23 Jul 2008, 05:01 »

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.
Logged
streever
Power Poster
***

Karma: 2
Offline Offline

Posts: 296

Location: New Haven, CT



WWW
« Reply #6 on: 11 Aug 2008, 12:48 »

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.
Logged

If I help you, please give good karma. If I'm rude, give me bad karma. I like to know where I balance out in the end Smiley.
applejack
Power Poster
***

Karma: 0
Offline Offline

Posts: 254


« Reply #7 on: 11 Aug 2008, 13:13 »

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.
Logged
Dr.CSS
Administrator
Power Poster
*****

Karma: 135
Offline Offline

Posts: 7713

Location: Arizona


formerly known as mark


WWW
« Reply #8 on: 11 Aug 2008, 15:53 »

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

Go to Extensions Modules/Tags click the name of the module/tag or the word Help to the right to get the parameters it takes...
Right click and view source is a great way to see what you have to work with...
Not sure what ver. CMSMS, PHP, server OS, etc. look at the System Information page...
OK if you removed the default content read it here... http://multiintech.com/defaultcontent/
People are Wonderful... Business is Great... Life is Terrific
streever
Power Poster
***

Karma: 2
Offline Offline

Posts: 296

Location: New Haven, CT



WWW
« Reply #9 on: 11 Aug 2008, 16:03 »

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.
Logged

If I help you, please give good karma. If I'm rude, give me bad karma. I like to know where I balance out in the end Smiley.
mathieu.bautista
Peanut Gallery


Karma: 0
Offline Offline

Posts: 6


« Reply #10 on: 13 Aug 2008, 09:37 »

Hi,

 Huh...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... Undecided

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 !  Wink

See you.
Logged
jubasolo
Forum Members
**

Karma: 0
Offline Offline

Posts: 19


« Reply #11 on: 14 Aug 2008, 13:54 »

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
Logged
jubasolo
Forum Members
**

Karma: 0
Offline Offline

Posts: 19


« Reply #12 on: 14 Aug 2008, 14:58 »

Also take a look at my final / temporary solution:

http://forum.cmsmadesimple.org/index.php/topic,23553.msg120417.html#msg120417
Logged
denli
Forum Members
**

Karma: 0
Offline Offline

Posts: 46


« Reply #13 on: 12 Oct 2008, 05:08 »

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

Logged
Dr.CSS
Administrator
Power Poster
*****

Karma: 135
Offline Offline

Posts: 7713

Location: Arizona


formerly known as mark


WWW
« Reply #14 on: 14 Oct 2008, 04:55 »

@denli

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

Go to Extensions Modules/Tags click the name of the module/tag or the word Help to the right to get the parameters it takes...
Right click and view source is a great way to see what you have to work with...
Not sure what ver. CMSMS, PHP, server OS, etc. look at the System Information page...
OK if you removed the default content read it here... http://multiintech.com/defaultcontent/
People are Wonderful... Business is Great... Life is Terrific
Pages: [1] 2
Print
Jump to: