Page 1 of 1

Read Content from other pages

Posted: Thu Aug 20, 2020 10:59 pm
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

Re: Read Content from other pages

Posted: Thu Aug 20, 2020 11:24 pm
by velden

Re: Read Content from other pages

Posted: Fri Aug 21, 2020 9:29 am
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

Re: Read Content from other pages

Posted: Fri Aug 21, 2020 10:32 am
by velden
Useful too (probably what you are doing): https://docs.cmsmadesimple.org/introduc ... table-gcbs

Re: Read Content from other pages

Posted: Sat Sep 05, 2020 12:28 pm
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.

Re: Read Content from other pages

Posted: Sat Sep 05, 2020 12:51 pm
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

Re: Read Content from other pages

Posted: Sat Sep 05, 2020 1:21 pm
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.

Re: Read Content from other pages

Posted: Sat Sep 05, 2020 1:50 pm
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}

Re: Read Content from other pages

Posted: Sat Sep 05, 2020 2:34 pm
by DIGI3
also accepted is:

Code: Select all

($printcontent={page_attr key='title' page='contact'} scope=global}

Re: Read Content from other pages (Solved)

Posted: Sat Sep 05, 2020 3:56 pm
by andrewvideouk
Thank you so much DIGI3 that works great.

Andrew