Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 7 of 7
  1. #1
    Senior Member tha_Gsheep's Avatar
    Join Date
    Feb 2003
    Location
    Scotland
    Posts
    188
    Member #
    780
    Right heres the problem: I'm trying to make my homepage using css and php.
    The concept being I could load the bars on either side once, and then the
    bit in the middle would load a seperate .php file that contains a <DIV>
    layer that has its own abasolute style placing to load right in between
    the two bars.

    To do this I've used a "if" loop to determine if a posted value was present
    in the address upon load of the page. So every time the page was loaded it
    would be checking for a different number and if it was present it would
    load the correponding numbered .php file which would contain the <DIV>.

    Heres how it looks:

    <?php
    if ($c != "") {
    include("content".$c.".php");
    } else {
    include("content1.php");
    }
    ?>

    this is the if loop to check for the number that it will attach to the words
    "content" + "php" and attach them to the number thats been called upon.
    This forms the php filename like "content1.php".

    So when I put this in. As links
    <a id="link" href="bars.php?c=1">Services</a><br>
    <a id="link" href="bars.php?c=3">Portfolio</a><br>
    <a id="link" href="bars.php?c=2">Contact</a><br>
    <a id="link" href="bars.php?c=4">Links</a><br>

    Why the hell won't it load the additional images that are called upon in the
    individual <DIVS> it'll load just the text content.
    When a an <IMG SRC=""> or URL ("--") asks for an img it just dosen't load it, why?
    Sorry to be so specific but its just so everyone understands and even those with
    the least knowledge can suggest something or maybe someone learn something.

    I haven't got access to the actual files but I'll upload them to illustrate the problem as soon as I can.
    www.appletv.co.uk

  2.  

  3. #2
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    Try this:
    PHP Code:
    <?php
    is_set($c) ? $c 1;
    include(
    "content$c.php");
    ?>

  4. #3
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    Actually, upon reading this in more detail, it seems your problem is with the content in each page. Remember that your image references will be relative to the url of BARS.PHP, not CONTENTx.PHP, so make your images link to the appropriate relative path, i.e.:
    [folder structure]
    /
    /bars.php

    /images/
    /images/image.gif

    /includes/
    /includes/content1.php

    You wouldn't reference your image relative to the content file, but the bars file, like this:
    [content1.php]:
    Code:
    <img src="./images/image.gif">

  5. #4
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    Incidentally, you're using Server Side Includes wrong (although in a unique way). You should do it like so:
    1. Create a file called "header.php" or "header.htm" that contains all of your HTML up until your content (usually top and left)
    2. Create a file called "footer.php" or "footer.htm" that contains all of your HTML after your content (usually bottom and right)
    3. In each of your content files (home.php, about.php, portfolio.php, etc) use this structure:

    PHP Code:
    <?php include("header.php"); ?>
    Here's my content.
    <?php include("footer.php"); ?>
    This is better because:
    1. Search engines will index every page, not just page 1,
    2. You don't need complex PHP to resolve each page, and
    3. When you change your header, say to add a link or two, it will change ALL pages that include it... meaning you only have to change your look and feel / navigation once

    Hope that helps !!!

  6. #5
    Senior Member james's Avatar
    Join Date
    May 2003
    Location
    Melbourne, AUSTRALIA
    Posts
    364
    Member #
    1352
    Looks like the contentX.php files are in the same directory as bars.php ... does the bars.php file look like this?
    PHP Code:
    <?php
    /* HEADER */
    if ($c != "") {
    include(
    "content".$c.".php");
    } else {
    include(
    "content1.php");
    }
    /*FOOTER */
    ?>
    And your header file:
    Code:
    <html>
    <body>
    <!-- Menu Stuff -->
    <div>
    The footer file:
    Code:
    </div>
    </body>
    </html>
    The contentX.php file:
    Code:
    <h1>Content X</h1>
    <p>Hello!</p>
    Hmm? Actually, I think Trans might be onto something, are the contentX.php files definitely in the same dir as bars.php?
    James H
    Home Page · Mars Page · www.fihsf1.net (formerly www·fihs·net)

  7. #6
    Senior Member tha_Gsheep's Avatar
    Join Date
    Feb 2003
    Location
    Scotland
    Posts
    188
    Member #
    780
    yup definetly, its just the images that are not. They reside in their respective folders
    www.appletv.co.uk

  8. #7
    Senior Member james's Avatar
    Join Date
    May 2003
    Location
    Melbourne, AUSTRALIA
    Posts
    364
    Member #
    1352
    Try loading content1.php etc by themselves. They're not full HTML files, but they should still display the images if the references are correct. If not, you have to fix up those files.
    If they do render the images, right click on the missing images (the [X] symbol) and select properties, see where it points... otherwise I'm stumped.
    James H
    Home Page · Mars Page · www.fihsf1.net (formerly www·fihs·net)


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 10:39 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com