Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
More than one content areas...
#1
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.
Reply
#2
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. Smile
Reply
#3
Thank you, it works like charm.
Rich
I don't say this enough, but I do appreciate the help.
Reply
#4
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. Smile

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 Smile
Reply
#5
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.
Reply
#6
Don't forget to enclose the code in php tags.
Code:
<?php

?>
Rich
I don't say this enough, but I do appreciate the help.
Reply
#7
Rich Wrote:Don't forget to enclose the code in php tags.
Code:
<?php

?>


Ah ye that did the trick Smile Thought it'd be somthing simple. Im new to the world of php Smile

Thanks for your help!
Reply




Users browsing this thread: 1 Guest(s)