Including Content Help

Trikip

Can you Handel this?
  • 1,643
    Posts
    20
    Years
    I have just gotten a new layout, so I decided to start including content now, instead of including the layout. I have read a few tutorials, but I just don't undrstand it. Could someone explain it a little clearer, or set it up for me? Thanks.

    EDIT: Oops meant to post this in General...or does it go here?
     
    Last edited:
    your layout acts as a shell or wrapper around your content.. so you format your content to how you want it to display and include it into your layout or index page. you can use either php or ssi (.shtml) to do so.

    if you need help with the include codes, we'll need to know what system you plan to use.
     
    saul said:
    do you mean php includes?

    Yes, I do. I have been including the layout, but I decided to start icluding the content instead. I just need some help.
     
    PHP:
    <?
    if(isset($_GET['id']))
    {
    $id=$_GET['id'];
    // include php
    if(is_file($id . ".php"))
    {
    include $id . ".php";
    }
    else
    {
    // include html
    if(is_file($id . ".html"))
    {
    include $id . ".html";
    }
    // your 404 text
    else echo "404 - Page/File Not Found.";
    }
    }
    // your default filefile
    else include "show_news.php";
    ?>

    That code goes in your layout (which needs to be index.php), where your content should go. The only thing you need to change is the second to last line with "else include" on it. That will be the page that shows up when you just type in index.php. Just put your news page in there.

    Now all your other content needs to be .php from now on and should not have the SSI includes on them. Then to display those you would have index.php?id=pagelocation without the .php. You can also have folders like index.php?id=folder/pagelocation . If you have any questions just ask. ^^
     
    But if you have nothing on the content pages but the content, how does the layout get there?
     
    When I make a new page, I go to the page to see if it worked, but the layout just turns up all messed up and the content doesn't appear. Could someone just set it up for me? I don't mean set up all the pages, just one page to show me how to do it.
     
    Trikip this is what you do, in your pages right now like say https://pokejunction.jkaizer.net/index.php, you should have something like <? include php ("layoutpage.php") ?> and then under that <div style="z-index: 1; left: -470px; width: 450px; position: absolute; top: -55px; height: 132px;" id="layer1" align="left"><font face="Arial"><font color="#FFFFFF" face="Geneva, Arial, Sans-serif" size="1"> well what you need to do is copy the code that you have on your index pages, and all other pages that is similar to <div style="z-index: 1; left: -470px; width: 450px; position: absolute; top: -55px; height: 132px;" id="layer1" align="left"><font face="Arial"><font color="#FFFFFF" face="Geneva, Arial, Sans-serif" size="1"> and put it on your index page under that paste the code that pichusecretbase posted, and if you need any other help go on AIM and I will help or just PM me.
     
    I know how to include the layout, but I wanted to try including the content because it's supposed to be easier...
     
    Before putting in your PHP code then, copy a page of content and put it there. Once the content looks right replace teh content with the code. The code goes right where the content goes.

    The url brings teh content into the layout id=pagename so it'd be index.php?id=pagename
     
    I could set it up for you ^^

    But you'd have to trust me to get into the CPanel or FTP >>;
     
    pokejungle said:
    I could set it up for you ^^

    But you'd have to trust me to get into the CPanel or FTP >>;

    Of course I trust you. I'll PM you.
     
    Back
    Top