Page 1 of 1

User-defined tag to access multiple content blocks

Posted: Sun Apr 15, 2007 11:20 am
by jsmonzani
Hello,

I'm browsing the documentation for some time, but couldn't find what I'm looking for  ::)

I would like to define a tag that allows me to access a specific content block based on its name and a page ID.

My idea is to build a multi-lingual version of my site without using the old 1.0.2 MLE branch.
It would work by picking up the right content blocks depending on the selected language.

For instance, I would thus add the following blocks for French to my template, that would replace the {title} and {content} of the page

{content block="FRmenu"}
{content block="FRtitle"}
{content block="FRcontent"}

I would then just need to make the menu using the blocks named "FRmenu" instead of $node->menutext... and that's my problem! I couldn't find where and how are these extra content blocks stored.

Thank you for your advices.


PS: Is there something else than this doc? http://www.cmsmadesimple.org/apidoc/
If often see you guys using $gCms and don't know where you get the doc from. Sorry if I sound stupid.

Re: User-defined tag to access multiple content blocks

Posted: Sun Apr 22, 2007 7:07 pm
by jsmonzani
OK, I'm gonna answer my own question ;)
additional content blocks are simply added with their own names, so something like this would for instance retrieve the block named "FR-title"

Code: Select all

global $gCms;
$manager =& $gCms->GetHierarchyManager();
$thisPage = $gCms->variables['content_id'];
$currentNode = &$manager->sureGetNodeById($thisPage);
$currentContent =& $currentNode->getContent();
echo 'fr title is: ' . $currentContent->GetPropertyValue('FR-title'); 
There's also a GetAdditionalContentBlocks  method in the Content object.