User-defined tag to access multiple content blocks

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
jsmonzani
Forum Members
Forum Members
Posts: 54
Joined: Mon Apr 03, 2006 10:58 am

User-defined tag to access multiple content blocks

Post 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.
An approach to mutli-lingual CMSMS using only content blocks:
http://forum.cmsmadesimple.org/index.ph ... 756.0.html
jsmonzani
Forum Members
Forum Members
Posts: 54
Joined: Mon Apr 03, 2006 10:58 am

Re: User-defined tag to access multiple content blocks

Post 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.
An approach to mutli-lingual CMSMS using only content blocks:
http://forum.cmsmadesimple.org/index.ph ... 756.0.html
Post Reply

Return to “Developers Discussion”