Posts: 14
Threads: 5
Joined: Jan 2010
I have searched the forum for some answers, but I don't seem to work for me. I have one page at the moment, acting as the homepage. There are three areas in the page that I need to be able to edit. At the moment the php where the content is is just <?php get_page_content(); ?> which just repeats what ever is in the index page in each area. How can I have 3 different content areas for one page?
Please try to keep it simple as ive not used php for long.
Thanks.
Posts: 13
Threads: 2
Joined: Sep 2009
Mike has a very simple tutorial on how to incorporate multiple content fields in a single page.
You can find it here.
I haven't tried it out myself, but I'll be toying with it on a few upcoming projects.
Posts: 27
Threads: 6
Joined: Jan 2010
Thank you, it works like charm.
Rich
I don't say this enough, but I do appreciate the help.
Posts: 14
Threads: 5
Joined: Jan 2010
andymci Wrote:Mike has a very simple tutorial on how to incorporate multiple content fields in a single page. You can find it here.
I haven't tried it out myself, but I'll be toying with it on a few upcoming projects.
Thanks for the link. I have followed the steps, but at the moment I get a 500- internal server error.
I have added a template.php file in the theme folder and added the following code exactly:
Code:
function get_content($page){
$path = "data/pages";
$thisfile = @file_get_contents('data/pages/'.$page.'.xml');
$data = simplexml_load_string($thisfile);
echo stripslashes(htmlspecialchars_decode($data->content, ENT_QUOTES));;
}
Then I created child pages under the index page in the CMS panel called post-1, post-2 and post-3. Inside the template.php I added the following code where each post content will be:
Code:
<?php get_content('post-1'); ?>
Code:
<?php get_content('post-2'); ?>
Code:
<?php get_content('post-3'); ?>
Any ideas what I need to do now? - Thanks for your help
Posts: 27
Threads: 6
Joined: Jan 2010
The code :
Code:
function get_content($page){
$path = "data/pages";
$thisfile = @file_get_contents('data/pages/'.$page.'.xml');
$data = simplexml_load_string($thisfile);
echo stripslashes(htmlspecialchars_decode($data->content, ENT_QUOTES));;
}
goes in a functions.php file. Then add the functions.php file in to your template folder and you should be fine.
Rich
I don't say this enough, but I do appreciate the help.
Posts: 27
Threads: 6
Joined: Jan 2010
Don't forget to enclose the code in php tags.
Rich
I don't say this enough, but I do appreciate the help.
Posts: 14
Threads: 5
Joined: Jan 2010
Rich Wrote:Don't forget to enclose the code in php tags.
Ah ye that did the trick
Thought it'd be somthing simple. Im new to the world of php
Thanks for your help!