Page 1 of 1

How to include CMSimple page content in a separate page?

Posted: Mon Oct 03, 2016 12:49 am
by danieljasonpayne
I have a CMsimple site with a hidden page named "Vance M", I want to include the content that I create for that page into a separate non-CMSimple page. I have a separate page named "vance.php" that is in the CMSimple parent directory. It is just a simple page with one table... Basically I want some kind of script that will only pull the content from the "Vance M" CMSimple page and display it on Vance.php.

geturl

Posted: Mon Oct 03, 2016 11:06 am
by Maxim

Code: Select all

#CMSimple $output.=geturl('./userfiles/downloads/vance.php');#

Re: How to include CMSimple page content in a separate page?

Posted: Mon Oct 03, 2016 6:43 pm
by danieljasonpayne
???
I can't get that to work.

Re: How to include CMSimple page content in a separate page?

Posted: Mon Oct 03, 2016 9:04 pm
by cmb
danieljasonpayne wrote:I can't get that to work.
geturl() can be used to insert another document into a CMSimple page. If I understand you correctly, you're looking for the other way round. Basically, something like the following should do the trick in vance.php:

Code: Select all

<?php echo file_get_contents('http://your.cmsimple.installation/?name_of_the_page?print')?>
To find the proper URL, just browse to the respective CMSimple page and switch to print view. Note that this code requires the PHP ini setting allow_url_fopen to be enabled.

Re: How to include CMSimple page content in a separate page?

Posted: Tue Oct 04, 2016 12:33 am
by danieljasonpayne
I can't get that code to work with the CMSimple print page. I created a separate html page with random text, and I could get the php code to pull that text fine, but when I put in the URL of any CMSimple page, it pulls nothing.

Re: How to include CMSimple page content in a separate page?

Posted: Tue Oct 04, 2016 9:21 am
by cmb
danieljasonpayne wrote:[…], but when I put in the URL of any CMSimple page, it pulls nothing.
Assuming that non CMSimple URLs don't work either, most likely allow_url_fopen is disabled. If cURL is available (you can verify all that with phpinfo()), you can do somethink like:

Code: Select all

<?php curl_exec(curl_init('http://your.cmsimple.installation/?name_of_the_page?print'))?>

Re: How to include CMSimple page content in a separate page?

Posted: Tue Oct 04, 2016 9:40 am
by frase
Try "&print":

Code: Select all

<?php echo file_get_contents('http://your.cmsimple.installation/?name_of_the_page&print')?>
[zitat] I created a separate html page with random text, and ...[/zitat]
Use PHP-Page - "*.php"

For the startpage:

Code: Select all

<?php echo file_get_contents('http://your.cmsimple.installation/?&print')?>
Remember, you get only the content ... no styles, no layout ...

Edit:
But just I see, you get full html-code. 2 x <head> ...
Better, you try "iframe".

Edit 2:
If the required page "unpublished" - you get nothing.

Re: How to include CMSimple page content in a separate page?

Posted: Tue Oct 04, 2016 12:51 pm
by cmb
frase wrote:Try "&print":
Yes, of course. :oops:
frase wrote:But just I see, you get full html-code. 2 x <head> ...
Yes, indeed. Some post-processing would be required; I'd probably prefer using the DOM extension for this nowadays, but what geturl() does should also be sufficient.
frase wrote:Better, you try "iframe".
Perhaps the cleanest solution.

Re: How to include CMSimple page content in a separate page?

Posted: Tue Oct 04, 2016 1:34 pm
by Maxim
frase wrote:Better, you try "iframe".
http://foxpro.maxim.zp.ua/userfiles/dow ... nclude.zip

Re: How to include CMSimple page content in a separate page?

Posted: Tue Oct 04, 2016 11:35 pm
by danieljasonpayne
cmb wrote:If cURL is available (you can verify all that with phpinfo()), you can do somethink like:

Code: Select all

<?php curl_exec(curl_init('http://your.cmsimple.installation/?name_of_the_page?print'))?>
That was the issue! Once I figured out how to fix cURL it works like a dream! Thanks for the help!