How to get rendered page output within CMS
How to get rendered page output within CMS
Does anyone know of a way to access the rendered output of a page from with the CMS libraries? I've found examples of pulling individual content blocks for a page, but nothing covering rendering of the entire output of a page.
The only option I have come up with so far is using smarty to fetch the page externally from the web server, but seeing as the CMS does the page rendering anyway, it would be desirable to access the output from within if possible.
Any pointers or suggestions appreciated.
Cheers...
The only option I have come up with so far is using smarty to fetch the page externally from the web server, but seeing as the CMS does the page rendering anyway, it would be desirable to access the output from within if possible.
Any pointers or suggestions appreciated.
Cheers...
Re: How to get rendered page output within CMS
When you say render the whole page what exactly do you mean?...
Re: How to get rendered page output within CMS
I think what he means is a way to fetch a string containing the HTML for the entire page, including CSS, template, etc, as opposed to fetching a particular content block.
Re: How to get rendered page output within CMS
Dr CSS/Wishbone, thanks for responding.
Wishbone's comment is correct. I'm looking for a way to get the FULL content from a page programatically from within the CMS, just as if it were accessed from the web server - template applied, content and global content processed etc.
Any help appreciated.
Cheers...
Wishbone's comment is correct. I'm looking for a way to get the FULL content from a page programatically from within the CMS, just as if it were accessed from the web server - template applied, content and global content processed etc.
Any help appreciated.
Cheers...
Re: How to get rendered page output within CMS
Does this need to happen within your CMSMS instance? If not, have you considered an offline spidering tool or using curl to access and save your page contents?
Just curious - what is the use case?
S
Just curious - what is the use case?
S
Re: How to get rendered page output within CMS
Sorry, I should have provided a little more context.
Basically I am trying to work out a way to provide templated reusable content within the CMS. Normally I would use GCBs, but there is no way to provide a templated view for GCBs which end user editors can work with.
So the idea is to create a bunch of hidden pages on the site, and then reuse the rendered content from these pages to embed in other pages.
Cheers...
Basically I am trying to work out a way to provide templated reusable content within the CMS. Normally I would use GCBs, but there is no way to provide a templated view for GCBs which end user editors can work with.
So the idea is to create a bunch of hidden pages on the site, and then reuse the rendered content from these pages to embed in other pages.
Cheers...
Re: How to get rendered page output within CMS
How do you mean "there is no way to provide a templated view for GCB's"?tbaalham wrote:Sorry, I should have provided a little more context.
Basically I am trying to work out a way to provide templated reusable content within the CMS. Normally I would use GCBs, but there is no way to provide a templated view for GCBs which end user editors can work with.
Global content blocks use the same template engine as all other templates in CMS Made Simple. And they're edittable with the same wysiwyg editor if you want to. You can give every user rights to edit content blocks. I really don't see the problem?
Re: How to get rendered page output within CMS
Also if you use the CGSimpleSmarty module, you can grab content (and even content blocks) from other pages at source instead of rendered HTML. SO in your case you can have the hidden pages that authors can edit and preview to make sure it looks like what they need. Then you can use the functions built into CGSimpleSmarty to grab content from these pages and display on other public pages. It is that simple.
Re: How to get rendered page output within CMS
Thanks spcherub. I've checked out CGSimpleSmarty, but as far as I can tell, I can only pull out the content elements from a given page, not the full content including the template content.
e.g. say my page template is as follows:
<div class="bob">{content}</div>
From what I understand CGSimpleSmarty will let me access the value for the {content} block, but not the code (<div> etc.) around it.
Cheers...
e.g. say my page template is as follows:
<div class="bob">{content}</div>
From what I understand CGSimpleSmarty will let me access the value for the {content} block, but not the code (<div> etc.) around it.
Cheers...
Re: How to get rendered page output within CMS
again, why don't you just use GCB's for this?
You can also nest GCB's in GCB's so you can make one "template" GCB with a "content" GCB nested in it.
You can also nest GCB's in GCB's so you can make one "template" GCB with a "content" GCB nested in it.
Re: How to get rendered page output within CMS
Hi, the reason I can't use GCBs is that there is no option with GCBs to offer only part of the content block for editing by an Editor user. I want to template all of the complicated bits, and let the user just fill in the required information, just like they do with a page.
If there is a way I can programatically extract the rendered output from a page, then I can achieve what I am trying to do. I am currently trolling through the API docs, but if someone knows how to do this, that would be great.
Thanks!
If there is a way I can programatically extract the rendered output from a page, then I can achieve what I am trying to do. I am currently trolling through the API docs, but if someone knows how to do this, that would be great.
Thanks!
Re: How to get rendered page output within CMS
How about using CGSimpleSmarty to get the content as it was designed to do, but repeat the surrounding template code where you reuse the content. So in your example from above, if the source page is something like this...
Then where you use the content in a public way could be something like this...
If you use the same stylesheets in both templates then the end result will be what you want to happen (assuming I comprehend your requirement). You can repeat this for each of the blocks of content.
-S
Code: Select all
<div class="parent">
<div class="child">
{content block="custom_block"}
</div>
</div>
Code: Select all
<div class="parent">
<div class="child">
{$cgsimple->get_page_content('private','custom_block','foo')}{eval var=$foo}
</div>
</div>
-S