Forum for discussing general topics related to Couch.
4 posts Page 1 of 1
Hi,

I need to display a page of my CouchCMS website "inside" an iframe on another website.
But, for it to be perfect, I need to remove the top menu bar and logo from this page when it is inside the iframe.

The simple way to do this was to create another template, equal to the one I'm using, but without the top menu bar and logo and display the same contents that are shown on my original template.

Is it possible to create another template that accesses the same contents of another template in CouchCMS?

Thanks in advance for your help.
--
Alexvf
Hi,

One can fetch data belonging to any template and display it on any other template by using <cms:pages> tag with the 'masterpage' param pointing to the source template (https://docs.couchcms.com/tags-reference/pages.html).

That tag, by default, tries to fetch all cloned pages of the specified template and so it has params that can be set to constrain/filter the pages fetched.
However, if the template happens to be a non-clonable one, it will always contain only one page so doing just the following would be sufficient to get data from it -
Code: Select all
<cms:pages masterpage='template-x.php'>
    ....
</cms:pages>

Hope this helps.
Hi,

Thank you for the fast reply.

I did what you explained but I don't know which tag shows the content (of the editable region) of that page.

The template that has the content I need is called "useful-links.php" and has a single editable region named "main_content".
The template that I created to use inside the iframe is called "useful-links-iframe.php" and should be showing the same content that I added in the editable region of the main template.

I did the following in "useful-links-iframe.php" after checking the "Variables in Views" article from the CouchCMS documentation:
Code: Select all
...
<cms:pages masterpage='useful-links.php'>
     <cms:show my_blog_text />
</cms:pages>
...

But the HTML returns empty.
Should I be using another variable to show that content instead of "my_blog_text"?

Thanks again for you help.
--
Alexvf
Nevermind!
I should be using the name of the editable region.

I did it like this and is working as expected:
Code: Select all
...
<cms:pages masterpage='useful-links.php'>
   <cms:show main_content />
</cms:pages>
...

Cheers.
--
Alexvf
4 posts Page 1 of 1
cron