/    Sign up×
Community /Pin to ProfileBookmark

One Change Changes All—Help!

I put this in the wrong section, so lets see if this helps =]

[QUOTE]

Hello There. I am looking for a code that would allow me to just one page, in which would affect the others. Let me explain. My website has, on the side, a portion for the Awards. Underneith, there is a section where it shows the date and what happened (ex: 8.23.07: 1 new Entry). I display that on all pages (21 pages). Now i am looking for a way that i could just change it on 1 page, in which it affects the rest. So if i change it on say index.htm, it changes on all other pages. This would save me a ton of time, and would benefit the site.

i however do not want to use iframes, or any other frames to do this. If it is possible, it would be awesome to have in css, javascript, or any other “non-webpage’ format.

Thank you for you Valiant Efforts!

[/QUOTE]

to post a comment
Full-stack Developer

25 Comments(s)

Copy linkTweet thisAlerts:
@CentauriJul 31.2007 — You can do that with php includes if your server supports php, similar to what I described in this thread.
Copy linkTweet thisAlerts:
@ray326Jul 31.2007 — Or if PHP isn't available maybe SSI is.

http://httpd.apache.org/docs/1.3/howto/ssi.html
Copy linkTweet thisAlerts:
@youngdesignerauthorJul 31.2007 — Thanks, i will try these.
Copy linkTweet thisAlerts:
@youngdesignerauthorJul 31.2007 — Sorry for a double post.

Well, i just began looking. Im positive i cannot use SSI, but i am slightly interested in the php idea. Im slightly novice when it comes to more advanced coding. My question would be how to code the php file. Is it the same as a html document? How does it Differ?

Thank You for you Help on this one. I truly am looking for a quick updatable navigation bar, and you are truly helping me, and i thank you.

---~YoungDesigner
Copy linkTweet thisAlerts:
@CentauriJul 31.2007 — A php file [B][I]is[/I][/B] an html file - the only difference is that it also includes code that only a server php parser can understand, and the file has a .php file extension instead of .html or .htm. As the server is dishing out the files to the user's browser, any files with the .php extension go through an extra process where any php codes on the page are enacted upon before the file is sent out.
Copy linkTweet thisAlerts:
@youngdesignerauthorJul 31.2007 — Oh, so i should just code it like an ordinary .html file? the exception being that i wouldnt include the starter coding (ex: <html><head>. ect.)
Copy linkTweet thisAlerts:
@CentauriJul 31.2007 — For the section you want to be common to all pages, yes. If you have the section already in a page at the moment, just cut [B][I]only[/I][/B] that section of code out and place it in a new file with a .html file extension. Then on your site pages, replace the cut out code with the php include command [CODE]<?php include "[COLOR="Blue"]filename[/COLOR].html"; ?>[/CODE].

Then you have to rename your page files to use the file extension .php

Don't forget that the menu will now have to point to .php files instead of .html files.
Copy linkTweet thisAlerts:
@youngdesignerauthorJul 31.2007 — Sounds simple enough. If i have any troubles, i will contact you...seeing that you know plenty about php! Thanks Again for all you HelP!
Copy linkTweet thisAlerts:
@youngdesignerauthorJul 31.2007 — uhm...well, i tried the code in my program, but it doesnt seem to be working so i will go step by step.

  • * So i first got a new document (filename.htm)

    *Then i copied and pasted the navigation bar to filename.htm and replaced the navigation stuff with <?php include "filename.html"; ?>

    *
    I check the page and where the information is suppose to be, its blank


  • Here is the coding around that area:

    <body bgcolor="#5776B6" text="#FFFFFF">

    <!--Header-->

    <div style="position:absolute;top:0px;left:110px;">

    <img src="head.jpg"/>

    </div>

    <!--Links-->

    <div style="position:absolute;top:220px;left:105px;width:150px;">

    [COLOR="Red"]<?php include "filename.htm"; ?>[/COLOR]

    </div>

    <!--Stats-->

    <div style="position:absolute;top:483px;left:105px;width:150px;">

    <img src="stats.gif" />

    <small>
    [/quote]


    Here is the coding from the filename.htm:

    <img src="navigation.gif" />

    <li><a href="index.php">Home</a>

    <li><a href="gadgets.php">TG Gadgets</a>

    <li><a href="gallery.php">Gallery</a>

    <li><a href="lotr.php">LotR</a>

    <li><a href="potc.php">PotC</a>

    <li><a href="hp.php">HP</a>

    <li><a href="guestbook.php">Guestbook</a>

    <li><a href="http://telpeathgift.proboards34.com" target="_new">Forum</a>

    <li><a href="awards.php">Awards</a>

    <li><a href="site.htm">Site</a>
    [/quote]


    What did i do wrong?
    Copy linkTweet thisAlerts:
    @CentauriJul 31.2007 — First up, you should have also included the surrounding div in the code snippet, and you also have a number of coding errors in the menu list - unclosed <li>s and no <ul>. Your filename.html (by the way, when I said filename, I meant use your own descriptive filename, like "menu.html") should look more like [CODE]
    <div style="position:absolute;top:220px;left:105px;width:150px;">
    <img src="navigation.gif" />
    <ul>
    <li><a href="index.php">Home</a></li>
    <li><a href="gadgets.php">TG Gadgets</a></li>
    <li><a href="gallery.php">Gallery</a></li>
    <li><a href="lotr.php">LotR</a></li>
    <li><a href="potc.php">PotC</a></li>
    <li><a href="hp.php">HP</a></li>
    <li><a href="guestbook.php">Guestbook</a></li>
    <li><a href="http://telpeathgift.proboards34.com" target="_new">Forum</a></li>
    <li><a href="awards.php">Awards</a></li>
    <li><a href="site.htm">Site</a></li>
    </ul>
    </div>[/CODE]


    Next thing is, are you viewing this on an actual internet site or locally on your computer? php requires a web server with the php parsing program installed and activated - you can set one up on your computer for testing purposes easily. I use xampp.
    Copy linkTweet thisAlerts:
    @youngdesignerauthorAug 01.2007 — I have been viewing it on my computer, that could have been the problem.

    So, i would take this (thanks for reconizing the errors) and put it into a html or htm file....then view it. I will get the program you suggest and see if it works.
    Copy linkTweet thisAlerts:
    @youngdesignerauthorAug 01.2007 — Im still not able to view it...=[
    Copy linkTweet thisAlerts:
    @tracknutAug 01.2007 — So now that it's on a server, can you give us the link to it? And you did verify that your server supports php, correct?

    Dave
    Copy linkTweet thisAlerts:
    @youngdesignerauthorAug 01.2007 — Yes, i would love to. Actually i was going to but something was wrong with teh WebDeveloper.com server and i couldnt post the link. Here it is: http://www.freewebs.com/telpeathsgift/index3.htm

    Im not sure if it will work on Freewebs, but it wasnt working on my computer either, so lets see what you all think. Thanks again for your help.
    Copy linkTweet thisAlerts:
    @tracknutAug 01.2007 — Hmmm.... I'm wondering whether you actually have php running on your machine. Put this code in a test.php file, push it out to your server and then use your browser to go to it and see what happens...

    <i>
    </i>&lt;?php
    echo '&lt;p&gt;hello world&lt;/p&gt;'
    ?&gt;
    Copy linkTweet thisAlerts:
    @youngdesignerauthorAug 01.2007 — im not sure i understand what you mean? This is what happened.... http://www.freewebs.com/telpeathsgift/test.php
    Copy linkTweet thisAlerts:
    @tracknutAug 01.2007 — So on a server running php, that file should print "hello world" on your screen. It doesn't, on yours. So my suspicion is you don't have php running on that server, or if it is, something's configured wrong. Have the server administrators told you php should be working?

    Dave
    Copy linkTweet thisAlerts:
    @CentauriAug 01.2007 — In both that link and your page linked earlier, you have comment tags [COLOR="Blue"]<!-- [/COLOR]instead of php tags [COLOR="Blue"]<?php[/COLOR], so in your pag e where you have [CODE]<!-- include "navi_bar.html"; ?>[/CODE], it should be [CODE]<?php include "navi_bar.html"; ?>[/CODE]
    Copy linkTweet thisAlerts:
    @youngdesignerauthorAug 01.2007 — im still not sure if i understand. My server, would that be freewebs...but the fact still remains that my computer, when using a editing program, doesnt show it. Is there an easier way to do what i want without going through php compatablitiy? Or is this the only way?

    Centauri: I now added that changed code, and it messes up the page, so something isnt quite working right....
    Copy linkTweet thisAlerts:
    @tracknutAug 01.2007 — im still not sure if i understand. My server, would that be freewebs...but the fact still remains that my computer, when using a editing program, doesnt show it. Is there an easier way to do what i want without going through php compatablitiy? Or is this the only way?
    [/QUOTE]

    Yes, freewebs. Since you don't have a PHP server running on your PC, you wouldn't be able to execute PHP locally. That's why you're not seeing it, which is completely normal.

    I just searched thru the FAQ at Freewebs, and here's a couple quotes from them:

    Does Freewebs Support Server-Side Includes (SSI)?

    YES! We support Server-Side Includes free of charge.

    What about MySQL, MSACCESS, and PHP?

    Unfortunately, Freewebs does not offer these functions.
    [/QUOTE]

    So they do not in fact support PHP, so none of the above should work. They do support SSI (which I haven't used, so take this with a grain of salt). My understanding is that the syntax for ssi is:

    <!--#include file="filename.html" -->

    and that your file needs to be named with .shtml or .shtm (like index.shtml for example). You'll have the same situation as with PHP - this is not something processed on your client, so you'll need to push the files to your server to see if it works.

    Dave
    Copy linkTweet thisAlerts:
    @youngdesignerauthorAug 01.2007 — So, let me see if i understand this.

    [LIST]
  • Place the <!--#include file="filename.html" --> code where i've been putting the php code
  • [/LIST]


    [LIST]
  • Then, like before, instead of putting php instead of htm, put shtml or htm?
  • [/LIST]


    [LIST]
  • Finally, im wondering if the coding should be the same as php, or that all i have to do is just copy and paste the code into the new page (filename.html)?
  • [/LIST]
    Copy linkTweet thisAlerts:
    @tracknutAug 01.2007 — So, let me see if i understand this.

    [LIST]
  • Place the <!--#include file="filename.html" --> code where i've been putting the php code
  • [/LIST]

    [/QUOTE]

    Yep

    [LIST]
  • Then, like before, instead of putting php instead of htm, put shtml or htm?
  • [/LIST]

    [/QUOTE]

    your file should be named something.shtml or something.shtm

    [LIST]
  • Finally, im wondering if the coding should be the same as php, or that all i have to do is just copy and paste the code into the new page (filename.html)?
  • [/LIST]
    [/QUOTE]

    The included file is still just the html file, same as the way it would be for PHP. Like I say, I haven't used SSI myself, so I'm not the best expert to explain this one to you. But my understanding is what's here.

    Dave
    Copy linkTweet thisAlerts:
    @youngdesignerauthorAug 01.2007 — One last question, and i really do respect you teaching me what you know....

    when you said [I]your file should be named something.shtml or something.shtm[/I], is this concerning the things in my navigation, which would be on the html file? So, let me explain what im thinking....all the coding that i want to appear on the page would go on filename.html. Then on the page that i want the stuff to appear on, i put the one code. Now on the stuff i want on the page, i put <a href="filename.shtml">Name</a>?
    Copy linkTweet thisAlerts:
    @tracknutAug 02.2007 — I'm not sure I'm following you completely. You need to take the file you currently have as http://www.freewebs.com/telpeathsgift/index3.htm and rename it from index3.htm to index3.shtml. Then inside that file, you've got to update what is now a php include statement to be the correct syntax for an SSI include of the file navi_bar.html. Then you need to actually have a file called navi_bar.html out in the same directory, with you navigation code in it. That navigation code is standard html, and can contain various <a href...> commands in it.

    I hope that makes sense.

    Dave
    Copy linkTweet thisAlerts:
    @youngdesignerauthorAug 02.2007 — Yes, that makes sense to me. Well, i'll give it a shot and see if it works.
    ×

    Success!

    Help @youngdesigner spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.19,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...