Page 1 of 1

Get Page Content

Posted: Wed Jan 27, 2016 5:17 am
by cpansewicz
Hi, I searched through the documentation, and read some posts about this, but haven't been able to solve this. I just upgraded from 1.x to 2.1.1. In my old site I used in many places:

{eval var=$cgsimple->get_page_content('pagealias')}

I'm not sure what to replace that with in 2.1.1. I used the old code to pull content from one page into another.

Thank you for any assistance.

Re: Get Page Content

Posted: Wed Jan 27, 2016 6:45 am
by Rolf
You can use the core {page_attr} tag now

Re: Get Page Content

Posted: Wed Jan 27, 2016 3:02 pm
by cpansewicz
Thank you. I did see that in another post, and read the documentation, but am unsure how to implement this for importing content from one page into another. Could you provide an example?

Re: Get Page Content

Posted: Wed Jan 27, 2016 6:06 pm
by velden
Examples:

Code: Select all

++++++++++

{page_attr page='how-cmsms-works' key='title'}

++++++++++

{page_attr page='how-cmsms-works' key='_dflt_'}

++++++++++

{page_attr page='how-cmsms-works' key='_dflt_' assign='othercontent'}
{eval var=$othercontent}

++++++++++

{page_attr page='how-cmsms-works' key='someothercontentblockname'}

Re: Get Page Content

Posted: Wed Jan 27, 2016 10:33 pm
by cpansewicz
Thank you! That worked. I appreciate the working example.

Re: Get Page Content

Posted: Thu Jan 28, 2016 5:04 am
by cpansewicz
One more question, would:
{eval var=$cgsimple->get_page_content($child.alias)}

convert to:
{eval var=$page_attr page="($child.alias)" key="_dflt_"}

Thank you. I use this a lot for generating tabbed content.

Re: Get Page Content

Posted: Thu Jan 28, 2016 7:52 am
by velden
It's (almost) in the examples above:

Code: Select all

{page_attr page=$child.alias key='_dflt_' assign='othercontent'}
{eval var=$othercontent}

Probably this will work too:

{eval var={page_attr page=$child.alias key='_dflt_'}}


Re: Get Page Content

Posted: Thu Jan 28, 2016 3:42 pm
by cpansewicz
Ok, thank you. I have several templates that I wrote that worked with CMS 1.xx, I will have to adapt them to the new cms, but I don't know enough of smarty.

Re: Get Page Content

Posted: Sun Jan 31, 2016 3:10 am
by cpansewicz
Thanks again, that worked! Would you be able to help with these two lines of code from CMS 1.xx:

1. {foreach from=$cgsimple->get_children($page_alias, true, $children) item='child' name='panel'}
and

2. {$cgsimple->get_page_title($child.alias)}

I converted the -> to :: in my code, but I think there is something else that I need to do to get these statements to work.