Read Content from other pages Topic is solved

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.
Post Reply
andrewvideouk
Forum Members
Forum Members
Posts: 155
Joined: Thu Aug 20, 2020 10:49 pm

Read Content from other pages

Post by andrewvideouk »

Hi

its posbile to read content from other pages. for expamle I am in the home page but I want to read all the content from a other page and put in the home page.

I want to use one of the pages like global content but I want it to be easy for a user to edit as global_content its for templaces.


Before I used a module maker which allow to make a module with require fields inputs. which not support in the new cmsms.

Can some help cheers
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3484
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: Read Content from other pages

Post by velden »

andrewvideouk
Forum Members
Forum Members
Posts: 155
Joined: Thu Aug 20, 2020 10:49 pm

Re: Read Content from other pages

Post by andrewvideouk »

Thank you so much. I was serching all night how do this. Yes I already installed Custom Global Settings module which its very useful
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3484
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: Read Content from other pages

Post by velden »

Useful too (probably what you are doing): https://docs.cmsmadesimple.org/introduc ... table-gcbs
andrewvideouk
Forum Members
Forum Members
Posts: 155
Joined: Thu Aug 20, 2020 10:49 pm

Re: Read Content from other pages

Post by andrewvideouk »

I am doing someting worng here. I am trying to get content from other pages. Can someone help please?

{page_attr key='content_en' page='contact' assign='printcontent'}
{page_attr key='title' page='contact' assign='printtitle'}

{$printtitle}
{$printcontent}

Thank you. Have a great day.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3484
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: Read Content from other pages

Post by velden »

Two things come to my mind:

- pages you want the content from can NOT be disabled (should be active)
- Smarty scopes: https://cmscanbesimple.org/blog/smarty-scope-examples
andrewvideouk
Forum Members
Forum Members
Posts: 155
Joined: Thu Aug 20, 2020 10:49 pm

Re: Read Content from other pages

Post by andrewvideouk »

Thank you did I looked at the page and I am more confused. The pages are Active.

I try adding scope=global still no luck.
<-- Before Header -->
{page_attr key='title' page='contact' assign='printcontent' scope=global}
{page_attr key='content_en' page='contact' assign='printcontent' scope=global}
<-- main content of the courent page -->
{$printcontent}
{$printtitle}


I might have to make a UDT to get other page content and do something like this

$data = file_get_contents('http://cmsmssite.com/otherpage);
then strip out all any html and some how get the H1 tilte and get content between a div.

if there no smary do this.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3484
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: Read Content from other pages

Post by velden »

You can't use the scope parameter on the page_attr tag

Code: Select all

{page_attr key='title' page='contact' assign='printcontent'}{$printcontent=$printcontent scope=global}
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1629
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: Read Content from other pages

Post by DIGI3 »

also accepted is:

Code: Select all

($printcontent={page_attr key='title' page='contact'} scope=global}
Not getting the answer you need? CMSMS support options
andrewvideouk
Forum Members
Forum Members
Posts: 155
Joined: Thu Aug 20, 2020 10:49 pm

Re: Read Content from other pages (Solved)

Post by andrewvideouk »

Thank you so much DIGI3 that works great.

Andrew
Post Reply

Return to “CMSMS Core”