Page 1 of 1
Page merge
Posted: Thu Mar 03, 2011 2:41 pm
by [MaGuS]
Hi!
I would like to display more than one cmsms page on one page, but all rendered with the template assigned to it... Tried PageBlocks on 1.9.3 but nothing just white screen

Is there any way, to display more than one page? PageMerge seems the solution but no files on Forge
Thx
Re: Page merge
Posted: Thu Mar 03, 2011 3:07 pm
by Wishbone
Create a UDT called 'get_page'
Code: Select all
global $gCms;
$cntnt = $gCms->getContentOperations();
$page_alias = $params['page_alias'];
$page_data = $cntnt->LoadContentFromAlias($page_alias);
$page_content = $page_data->mProperties->mPropertyValues['content_en'];
$smarty->assign($params['assign'], $page_content);
In a page, you can reference another page by calling:
Code: Select all
{get_page page_alias='home' assign='home_content'}
{eval $home_content}
Make sure you don't end up in a endless loop, such as get-page'ing the page you're on.. No telling what will happen.

Re: Page merge
Posted: Thu Mar 03, 2011 3:18 pm
by [MaGuS]
Hey you are really fast

Thanks
Something seems missing, the error thrown is
Code: Select all
string(132) "Smarty error: [in content:content_en line 10]: syntax error: invalid attribute name: '$about' (Smarty_Compiler.class.php, line 1550)"
Re: Page merge
Posted: Thu Mar 03, 2011 3:24 pm
by [MaGuS]
As I try to understand the code seems to me that it will display the "content" block of the page but without the template assigned to it... Am I right?
Re: Page merge
Posted: Thu Mar 03, 2011 3:31 pm
by [MaGuS]
The thread
http://forum.cmsmadesimple.org/viewtopic.php?t=46612 seems will be a solution. Will try soon...
Re: Page merge
Posted: Thu Mar 03, 2011 4:23 pm
by Wishbone
[MaGuS] wrote:As I try to understand the code seems to me that it will display the "content" block of the page but without the template assigned to it... Am I right?
Hmm.. It worked for me.. I am running an older version however.. I'll look at it later today with one of my newer installs.
Yes.. The code assumes that you are already on a page with content. This UDT will (or is supposed to) insert other pages' content into the current page (with the current page's template)... Did I misread your question?
Re: Page merge
Posted: Thu Mar 03, 2011 4:30 pm
by [MaGuS]
Thanks... It seems, in 1.9.3.there is no mPropertyValues:
Code: Select all
[mPropertyValues] => Array
(
[target] =>
[image] =>
[thumbnail] =>
[extra1] =>
[extra2] =>
[extra3] =>
[searchable] =>
[pagedata] =>
[disable_wysiwyg] =>
)
Uhhh, I would like to insert another page but in processed format... processed with the assigned template (this template has no html, body and meta tags) of 'inserted' page.
Re: Page merge
Posted: Thu Mar 03, 2011 5:00 pm
by calguy1000
The CGSimpleSmarty module does this already.
Code: Select all
{* display the content_en block from a specific page *}
{cgsimple->get_page_content('some_page_alias','content_en','tmp')}
{eval var=$tmp}
{* get all of the content_en blocks from all of the children of the current page and display them... untested *}
Code: Select all
{cgsimple->get_children('','children'}
{if $children}
{foreach from=$children item='child'}
<div class="child_content">
{cgsimple->get_page_content($child.alias,'content_en','tmp'}
{eval var=$tmp}
</div>
{/foreach}
{/if}
Re: Page merge
Posted: Thu Mar 03, 2011 5:15 pm
by [MaGuS]
Thanks... The same as it was with the other solution:
string(176) "Smarty error: [in content:content_en line 1]: syntax error: unrecognized tag: cgsimple->get_page_content('about-us','content_en','tmp') (Smarty_Compiler.class.php, line 446)" string(117) "Smarty error: [in content:content_en line 1]: syntax error: unrecognized tag '' (Smarty_Compiler.class.php, line 590)"
string(43) "Smarty error: eval: missing 'var' parameter"
Lost... Totally

Re: Page merge
Posted: Thu Mar 03, 2011 5:24 pm
by Wishbone
Did you install the CGSimpleSmarty module?
Re: Page merge
Posted: Thu Mar 03, 2011 5:32 pm
by [MaGuS]
Sure.
The problem solved now, the $ sign was missing from the {cgsimple...} copy paste
But the problem is the same: it puts the content block of the page without the template assigned to that page

Re: Page merge
Posted: Thu Mar 03, 2011 5:44 pm
by [MaGuS]
Just to be sure what I am trying...
There is a template: <h1>{$title}</h1>{content}<hr />
There is another template: <h2>{$title}</h2>{content}<h3>TheEnd</h3>
There are 3 pages: first and last with template 1, the second with template 2.
The output of a fourth ( main) page should generate this:
Code: Select all
<h1>PAGE 1 TITLE</h1>PAGE 1 CONTENT TEXT<hr />
<h2>PAGE 2 TITLE</h2>PAGE 2 CONTENT TEXT<h3>TheEnd</h3>
<h1>PAGE 3 TITLE</h1>PAGE 3 CONTENT TEXT<hr />
The solutions above give me this:
Code: Select all
PAGE 1 CONTENT TEXT PAGE 2 CONTENT TEXT PAGE 3 CONTENT TEXT
Hope I could write what I would like to achieve, and sorry for my english
