Page merge

A place to make for-pay "CMS made simple" job offerings
Post Reply
[MaGuS]
Forum Members
Forum Members
Posts: 13
Joined: Wed Jul 23, 2008 9:47 am

Page merge

Post 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
Wishbone
Power Poster
Power Poster
Posts: 1368
Joined: Tue Dec 23, 2008 8:39 pm

Re: Page merge

Post 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. ;)
[MaGuS]
Forum Members
Forum Members
Posts: 13
Joined: Wed Jul 23, 2008 9:47 am

Re: Page merge

Post 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)"
[MaGuS]
Forum Members
Forum Members
Posts: 13
Joined: Wed Jul 23, 2008 9:47 am

Re: Page merge

Post 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?
[MaGuS]
Forum Members
Forum Members
Posts: 13
Joined: Wed Jul 23, 2008 9:47 am

Re: Page merge

Post by [MaGuS] »

The thread http://forum.cmsmadesimple.org/viewtopic.php?t=46612 seems will be a solution. Will try soon...
Wishbone
Power Poster
Power Poster
Posts: 1368
Joined: Tue Dec 23, 2008 8:39 pm

Re: Page merge

Post 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?
[MaGuS]
Forum Members
Forum Members
Posts: 13
Joined: Wed Jul 23, 2008 9:47 am

Re: Page merge

Post 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.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Page merge

Post 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}
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
[MaGuS]
Forum Members
Forum Members
Posts: 13
Joined: Wed Jul 23, 2008 9:47 am

Re: Page merge

Post 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 :D
Wishbone
Power Poster
Power Poster
Posts: 1368
Joined: Tue Dec 23, 2008 8:39 pm

Re: Page merge

Post by Wishbone »

Did you install the CGSimpleSmarty module?
[MaGuS]
Forum Members
Forum Members
Posts: 13
Joined: Wed Jul 23, 2008 9:47 am

Re: Page merge

Post 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 :(
[MaGuS]
Forum Members
Forum Members
Posts: 13
Joined: Wed Jul 23, 2008 9:47 am

Re: Page merge

Post 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 :)
Post Reply

Return to “Help Wanted (commercial)”