Page 1 of 1

[solved]How to display content block from UDT?

Posted: Tue Mar 04, 2008 6:59 pm
by ader
Hello,
I'm using CMSMS v. 1.2.3 :)

I would like to create a UDT which will display the content of e. g. a {content block="test"} placed in the template "Test Template".

I created something like this (the default page is the target, containing {content block="test"):

Code: Select all

global $gCms;

$contops =& $gCms->GetContentOperations();
$default =& $contops->GetDefaultContent();
echo $default." | ";
$conts =& $contops->LoadContentFromId($default);
return $conts->Show();
It work fine, but the problem is, it displays only {content}. I would like to display a {content block="test"} or all content blocks.

Thank you in advance!

Re: How to display content block from UDT?

Posted: Tue Mar 04, 2008 7:03 pm
by calguy1000
Look at the CGSimpleSmarty module.  it has a get_page_content (or something like that) method to extract page content from a specified page and block.

Re: How to display content block from UDT?

Posted: Wed Mar 05, 2008 9:04 am
by ader
Thanks a lot, works perfect. Here is the code:

Code: Select all

{$cgsimple->get_page_content($cgsimple->get_root_alias(),test_en)}
I wanted to cheat the PDF template and put there the global content block presented above, but it's not displayed in PDF :(
I also tried to display this global content block with UDT, but it's displayed as a text then. Good for development big and complicated global contents...

Did you maybe think of integrating the SmartyReport to CMSMS? I tried already, it seemed easy but still beyond my capabilities.
Maybe for you - developers - it would be a matter of few minutes? I think is worth it to take a look, here is the link:

http://sourceforge.net/project/showfiles.php?group_id=205675

It's GNU Lesser General Public License  :)