I have a wordpress theme I created that contains a sidebar with a portion that the client wants to edit. I figured I could create a very basic "content" page under CMSMS with a blank template and then use php include to import it into the wordpress theme. It's mainly just going to be updating text with an image or two, nothing more.
I think the main problem is including a php file that doesnt have a proper file name. Since my page is index.php?page=blog-sidebar...
I realize its somewhat dangerous to have it setup this way, but I even tried the following code to retrieve the string query (my pagename) in my wordpress PHP (which is located at /blog/ and my CMSMS is located at the root):
$_GET['page'] = 'blog-sidebar';
include('../index.php');
What would you recommend the best way to do this would be.
I think If i could somehow make one of my pages have a URL of page.php instead of index.php?page=page it would work somewhat correctly.
External PHP Includes with content pages.
External PHP Includes with content pages.
Last edited by silence on Sun May 17, 2009 4:44 am, edited 1 time in total.
Re: External PHP Includes with content pages.
allow_url_fopen must be enable and your host needs to be linux
- will look for a file on the system
- will get a generated page
further reading:
http://br2.php.net/function.include
Code: Select all
include 'file.php?foo=1&bar=2';
Code: Select all
include 'http://www.example.com/file.php?foo=1&bar=2';
further reading:
http://br2.php.net/function.include
Code: Select all
<?php
/* This example assumes that www.example.com is configured to parse .php
* files and not .txt files. Also, 'Works' here means that the variables
* $foo and $bar are available within the included file. */
// Won't work; file.txt wasn't handled by www.example.com as PHP
include 'http://www.example.com/file.txt?foo=1&bar=2';
// Won't work; looks for a file named 'file.php?foo=1&bar=2' on the
// local filesystem.
include 'file.php?foo=1&bar=2';
// Works.
include 'http://www.example.com/file.php?foo=1&bar=2';
$foo = 1;
$bar = 2;
include 'file.txt'; // Works.
include 'file.php'; // Works.
?>
Re: External PHP Includes with content pages.
Thank you for the quick reply. My server is linux, where can I enable allow_url_fopen... Is it in the CMSMS config.php file?
By the way, here are the current errors I am receiving using the php include code I included above:
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/content/p/p/r/username/html/blog/wp-content/themes/pixeled.1.9.1/pixeled/header.php:7) in /home/content/p/p/r/username/html/include.php on line 34
Fatal error: Call to a member function GetConfig() on a non-object in /home/content/p/p/r/username/html/lib/adodb.functions.php on line 7
By the way, here are the current errors I am receiving using the php include code I included above:
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/content/p/p/r/username/html/blog/wp-content/themes/pixeled.1.9.1/pixeled/header.php:7) in /home/content/p/p/r/username/html/include.php on line 34
Fatal error: Call to a member function GetConfig() on a non-object in /home/content/p/p/r/username/html/lib/adodb.functions.php on line 7
Last edited by silence on Sun May 17, 2009 6:03 am, edited 1 time in total.
Re: External PHP Includes with content pages.
Why don't you just copy the sidebar and other files into UDTs?
Re: External PHP Includes with content pages.
Why don't you just use CMSMS as the input mechanism, but use straight db lookups for pulling the data into wordpress?
Nullig
Nullig
Re: External PHP Includes with content pages.
Nulling and ajprog presented better alternatives to achieve the same goal. If you can provide a link I can teach you how to do it.
Regards
G
Regards
G
Re: External PHP Includes with content pages.
The problem before was mainly with getting this file into my wordpress from CMSMS, and my host disabling allow_url_fopen wasnt helping at all....
I am going to try to have the blog use a db lookup to populate the page, instead of the multiple steps involved with includes....
I have this one page on my blog where I just want a small section of the page to come from the CMS. Is anyone familiar with using db lookups to get this done? Specifically with CMSMS.
Thanks again for all the help.
I am going to try to have the blog use a db lookup to populate the page, instead of the multiple steps involved with includes....
I have this one page on my blog where I just want a small section of the page to come from the CMS. Is anyone familiar with using db lookups to get this done? Specifically with CMSMS.
Thanks again for all the help.
Last edited by silence on Tue May 19, 2009 9:08 pm, edited 1 time in total.