[solved]How to display content block from UDT?

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
ader

[solved]How to display content block from UDT?

Post 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!
Last edited by ader on Wed Mar 05, 2008 9:05 am, edited 1 time in total.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: How to display content block from UDT?

Post 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.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
ader

Re: How to display content block from UDT?

Post 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  :)
Locked

Return to “CMSMS Core”