Get Page Content

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
cpansewicz
Forum Members
Forum Members
Posts: 142
Joined: Fri Jun 17, 2011 12:22 am

Get Page Content

Post 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.
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: Get Page Content

Post by Rolf »

You can use the core {page_attr} tag now
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
cpansewicz
Forum Members
Forum Members
Posts: 142
Joined: Fri Jun 17, 2011 12:22 am

Re: Get Page Content

Post 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?
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Get Page Content

Post 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'}
cpansewicz
Forum Members
Forum Members
Posts: 142
Joined: Fri Jun 17, 2011 12:22 am

Re: Get Page Content

Post by cpansewicz »

Thank you! That worked. I appreciate the working example.
cpansewicz
Forum Members
Forum Members
Posts: 142
Joined: Fri Jun 17, 2011 12:22 am

Re: Get Page Content

Post 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.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Get Page Content

Post 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_'}}

cpansewicz
Forum Members
Forum Members
Posts: 142
Joined: Fri Jun 17, 2011 12:22 am

Re: Get Page Content

Post 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.
cpansewicz
Forum Members
Forum Members
Posts: 142
Joined: Fri Jun 17, 2011 12:22 am

Re: Get Page Content

Post 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.
Post Reply

Return to “Modules/Add-Ons”