How to include CMSimple page content in a separate page?

General questions about CMSimple
Post Reply
danieljasonpayne
Posts: 4
Joined: Mon Oct 03, 2016 12:39 am

How to include CMSimple page content in a separate page?

Post by danieljasonpayne » Mon Oct 03, 2016 12:49 am

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.
Last edited by danieljasonpayne on Mon Oct 03, 2016 6:32 pm, edited 1 time in total.

Maxim
Posts: 121
Joined: Thu Jun 13, 2013 6:52 am
Location: Запорожье
Contact:

geturl

Post by Maxim » Mon Oct 03, 2016 11:06 am

Code: Select all

#CMSimple $output.=geturl('./userfiles/downloads/vance.php');#
Simple Hosting
Бедная, бросаемая бурею, безутешная!

danieljasonpayne
Posts: 4
Joined: Mon Oct 03, 2016 12:39 am

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

Post by danieljasonpayne » Mon Oct 03, 2016 6:43 pm

???
I can't get that to work.

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

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

Post by cmb » Mon Oct 03, 2016 9:04 pm

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.
Christoph M. Becker – Plugins for CMSimple_XH

danieljasonpayne
Posts: 4
Joined: Mon Oct 03, 2016 12:39 am

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

Post by danieljasonpayne » Tue Oct 04, 2016 12:33 am

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.

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

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

Post by cmb » Tue Oct 04, 2016 9:21 am

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'))?>
Christoph M. Becker – Plugins for CMSimple_XH

frase
Posts: 5085
Joined: Thu Apr 21, 2016 6:32 am
Location: Saxony
Contact:

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

Post by frase » Tue Oct 04, 2016 9:40 am

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.

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

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

Post by cmb » Tue Oct 04, 2016 12:51 pm

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.
Christoph M. Becker – Plugins for CMSimple_XH

Maxim
Posts: 121
Joined: Thu Jun 13, 2013 6:52 am
Location: Запорожье
Contact:

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

Post by Maxim » Tue Oct 04, 2016 1:34 pm

frase wrote:Better, you try "iframe".
http://foxpro.maxim.zp.ua/userfiles/dow ... nclude.zip
Simple Hosting
Бедная, бросаемая бурею, безутешная!

danieljasonpayne
Posts: 4
Joined: Mon Oct 03, 2016 12:39 am

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

Post by danieljasonpayne » Tue Oct 04, 2016 11:35 pm

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!

Post Reply