Creating sections

Hey guys, Okay, this might be easy, might be impossible - I don’t know. I’ll try to make this clear as possible.

p.s: I wanted to search for this, but I honestly don’t even know what my search terms would be. Sorry if this has been posted before.

I have my layout which I am using, which is named “layout.php”.
Now, I have a page, lets call it examplepage.php

I included layout.php to the examplepage.php and it pulls it in beautifully

However, I want to be able to edit the content on that page, and have it fall into a SPECIFIC part of the layout.

Anytime I add the content, it gets pushed to the bottom of the page under all of the

's. I need to find a way to add to the layout.php that “this is the title”, and “this is the content” in the middle of the divs, but be able to modify the title and content anytime I want on that page, NOT on the layout.php page.

If anyone has any idea what I’m talking about, I’d appreciate some help.

Also, included a cropped screen shot to show more so what I mean.

How is your layout.php constructed? Also, when you say you want to be able edit content, title - do you mean you want to do this via web interface?

Thank you for the quick response.

Right now, layout.php includes the top nav bar, the left nav bar, the right information pane, and the footer.
The main content section is the section in the middle, which is where I want to add the “title” (not web page title, but there’s actually a “title” div), as well as the content of the page. (Example: F.A.Q would display and just below that would be the actual FAQ content.)

No, I am not concerned with editing it via the webpage, I can do it all from the actual files.
When I started this, I started in 100% HTML, then I decided to convert them all to .php so I can do things such as add the footer without having to copy and paste the footer into every page, then I added a date function to display current date.

The problem with this, though, is that every page is the same, except for the main content section (and the links showing above it, such as Home -> Support -> F.A.Q, etc, those change as the pages change. The problem, however, is that if I decide I want to change something on the layout, I have to go through and change it on EVERY single file, which I’ve done a few times and have grown tired of it.

I’d like to keep the universal layout, so if I want to change something, I just change layout.php, and then I can simply change individual pages as they all have “include layout.php” in them.


Well, I am not sure how you include the layout to your pages and how you pass content to layout, but I think something simple like this should work for you:


<?php echo $title ?> <?php echo $content ?> [/php]


<?php $title = 'Custom title for this page'; $content = 'Custom content for this page'; include('inc/layout.php'); ?>


Sure if you have other areas with content that differs from page to page, you need to add more variables like $left_bar, $right_bar, etc.

Sorry, I don’t think I was specific enough, I apologize. When I meant title, I meant something else. I’ve included another screen shot which shows more specific what I mean. It’s an example News page,

The red lined areas are the

s, I need the title (1) to go in THAT div, and the content (2) to go in THAT div. So far, I just get it to go below the very bottom div, even below the footer.

Included screen shot:

Without seeing your code of layout.php it is hard to give advise. How do you insert dynamic content into layout? How do you store content (title, etc.) in your pages? I provided example to give you idea how this can be done, but you probably use some other technique.

It was all originally HTML files, everything in it it HTML except for the footer and the today’s date function.

Sponsor our Newsletter | Privacy Policy | Terms of Service