SitePoint Sponsor

User Tag List

Results 1 to 9 of 9

Thread: HTML and PHP

  1. #1
    SitePoint Member
    Join Date
    Jan 2010
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    HTML and PHP

    I have knowledge of HTML but not of PHP. I am trying to edit a site that incorporates both.

    For instance, there are files of index.html index.php about.php calendar.php events.php

    I only edited the index.html page to reflect the weeks upcoming events column which is on the left side of the page. I can see the current updates when I go to mywebsite dot com/index.html or just mywebsite dot com.

    //sorry I had to do that , I'm a noob

    But once you select the home, about, calendar, or events buttons and the URL reads:

    mywebsite dot com/about.php mywebsite dot com/calendar.php etc, that left hand column goes back to the previous weeks events that was listed on the index.html page before I updated the content.

    What am I missing?

  2. #2
    SitePoint Wizard bronze trophy Tyssen's Avatar
    Join Date
    Oct 2005
    Location
    Brisbane, QLD
    Posts
    4,067
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The columns in the pages with .php extension are probably being pulled in from an include. What's your directory structure look like?

  3. #3
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,299
    Mentioned
    460 Post(s)
    Tagged
    8 Thread(s)
    I'm surprised there's an index.html and index.php. The first will overide the other. If you look at the code for one of the other pages, look at what's in place of the week's events section. You will probably see something like

    <?php include('includes/events.php'); ?>

    That little url in there (includes/events.php) is the location of the file where the events details are being pulled from. You can open that file and make the changes there, and they will automatically feed into all pages.

    It would be better to replace index.html with index.php, though, and add the events code there too, so that you don't have to update the index page separately.

  4. #4
    SitePoint Member
    Join Date
    Jan 2010
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    These codes for the header and footer are in all the .php files.

    include ('./includes/header.inc');
    include ('./includes/footer.inc');

    ralph.m, you said "I'm surprised there's an index.html and index.php. The first will overide the other."

    It kind of seems the other way. I can load up the index.html page with the changes I have made, but click on the home button and it goes to index.php and the old information.

    The site was done by two guys, the less knowledgeable one was the one I spoke with briefly about the updates. He did it on Dreamweaver I believe and didn't show me in CPanel. All I'm trying to do is edit the code. He has some files in there too that are wysiwygPro_edit_(encrypted code).php I don't know if that has anything to do with this.

    I think the includes are what I need to work on. Anymore suggestions would be great. This guy just wants my company to be having to pay him money to maintain the site so he would rather have us ignorant. I know this shouldn't be that complex and once I get it, will be simple.

    Anyway thanks for your help, I will keep working on it, but will appreciate further suggestions

  5. #5
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,299
    Mentioned
    460 Post(s)
    Tagged
    8 Thread(s)
    Do you want the information in the left column to be the same one every page? Or just the events information to appear on every page in the left column?

    It sounds like a few links need fixing and that the index.html file needs to be deleted. The Home link is clearly directed to index.php, but you see index.html when you go to mywebsite.com because it overrides index.php.

    SO: my first suggestion is to delete index.html (but of course keep a copy of any info you need to be in index.php).

    Then update index.php with the event info.

    If you want the events info to appear on other pages, we can instruct you on how to set up an include file for it, so that you don't have to update it manually on each page.

  6. #6
    SitePoint Member
    Join Date
    Jan 2010
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The weekly events column on the left needs to stay the same, no matter if you are reading the about us, or calendar, or directions page. That information should change in the center column, but the left column should constantly show the "coming this week" info.

    I will try without the index.html, but I am curious why it would be there in the first place? So you are saying if there is an index.php, I don't need to have an index.html? Would there be any advantage to having both?

  7. #7
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,299
    Mentioned
    460 Post(s)
    Tagged
    8 Thread(s)
    Quote Originally Posted by tr3p4y View Post
    I will try without the index.html, but I am curious why it would be there in the first place? So you are saying if there is an index.php, I don't need to have an index.html? Would there be any advantage to having both?
    Sounds like the original designer uploaded index.html, then decided to change it to index.php and forgot to delete the original from the server. There's no advantage in having both, only pure misery! Since you want the left column to appear on every page (including the home page) you definitely want index.php only.

    Next step is to create an include. There are various methods, but what I recommend is this:

    Whatever left column code you want to appear on each page (be it the whole column or just a certain part), cut out the code for that and paste it into a new file called leftcol.php. Place this file in the /includes/ folder.

    Then, in place of that code on each page, put this:

    <?php include $_SERVER["DOCUMENT_ROOT"] . "/includes/leftcol.php"; ?>

    Now the content in leftcol.php will appear on each page, no matter where it is on the site. So when you want to update the content, open that file and update it there.

    Just a side note. At some point you need to let the web designer know that you are doing this. Otherwise, if he/she makes changes to your site via ftp, they will overwrite anything you have done. They first need to download your changes before making any further changes. (I've seen this conflict happen, to the great misery of all...)

  8. #8
    SitePoint Member
    Join Date
    Jan 2010
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the help Ralph. i just figured it out.

    the includes were at: public_html/includes/theFileToChange.inc

    Now that I updated that as opposed to index.html, everything updates to what it needs to look like.

    I haven't removed the index.html yet, but I will let the webmaster know.

    Tr3p4y

  9. #9
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,299
    Mentioned
    460 Post(s)
    Tagged
    8 Thread(s)
    Great. Just be aware that those changes in the include file won't be refelcted on the index.html page, which is your main home page. (You have two home pages at the moment.)

    It's definitely a mistake to keep index.html. I suspect the designer has long forgotten about it.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •