1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Need help with HTML!

Discussion in 'HTML & Website Design' started by Soner, Jul 20, 2008.

  1. #1
    Hey advanced coders,

    I make my websites in HTML and for all pagees the header is the same. Instead of changing the header in every page (if I wanna make a change), is there a code to change it in one place and effects on all?

    Thanks
     
    Soner, Jul 20, 2008 IP
  2. Kerosene

    Kerosene Alpha & Omega™ Staff

    Messages:
    11,366
    Likes Received:
    575
    Best Answers:
    4
    Trophy Points:
    385
    #2
    You can use php to 'include' your header in every page.

    You make a header.php page - e.g with your logo and top menu.
    Then 'include' that page in all your other pages.

     
    Kerosene, Jul 20, 2008 IP
    Soner likes this.
  3. BlueDevil

    BlueDevil Peon

    Messages:
    19
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You could use php. Make a page called header.php, or something like that, and put the html code for the top section in it. Then, each of the pages, put:
    <?php include("header.php"); ?>
    PHP:
    or
    <?php require("header.php"); ?>
    PHP:
    They both work fine, but require make sure that if the header file isn't found, it stops the code completely. Also make sure they are all .php file.

    Hope this helps you.
     
    BlueDevil, Jul 20, 2008 IP
    Soner likes this.
  4. Soner

    Soner Active Member

    Messages:
    479
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    55
    #4
    Thanks guys, reputation given.
     
    Soner, Jul 20, 2008 IP
  5. 4220niller

    4220niller Peon

    Messages:
    35
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #5
    If your'e using require you should use:
    <?php require_once('header.php'); ?>
    Code (markup):
    That way it wouldnt be included more then 1 time.
     
    4220niller, Jul 20, 2008 IP
    Soner likes this.
  6. Soner

    Soner Active Member

    Messages:
    479
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    55
    #6
    Can someone change this HTML code to PHP code please, i will give reputation.
    
    <table width="766" border="0" cellpadding="0" cellspacing="0" align="center" style="height:144px ">
    							<tr>
    								<td width="266" height="144" valign="top"><div style="padding:48 0 0 55px "><img src="images/metrafinal.jpg" width="144" height="87"></div></td>
    								<td width="500" height="144" valign="top"><div style="padding:94 20 20 19px ">
    									<span class="footer"><a href="index.html"><img src="images/images/flashmenu_01.jpg" width="74" height="28" border="0"></a><a href="hakkımızda.html"><img src="images/images/flashmenu_02.jpg" width="95" height="28" border="0"></a><a href="referans.html"><img src="images/images/flashmenu_03.jpg" width="95" height="28" border="0"></a><a href="basvuru.html"><img src="images/images/flashmenu_04.jpg" width="73" height="28" border="0"></a><a href="iletisim.html"><img src="images/images/flashmenu_05.jpg" width="63" height="28" border="0"></a></span></div></td>
    							</tr>
    						</table>
    Code (markup):
     
    Soner, Jul 21, 2008 IP
  7. BANAGO

    BANAGO Active Member

    Messages:
    456
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    58
    #7
    You need to use PHP to do that. The best way is to use a CMS, they function in templates and you make one change to effect all the site. My preferred is WordPress.
     
    BANAGO, Jul 21, 2008 IP
  8. BANAGO

    BANAGO Active Member

    Messages:
    456
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    58
    #8
    This way is safer too. The previous is hackable.
     
    BANAGO, Jul 21, 2008 IP
  9. RWHost

    RWHost Active Member

    Messages:
    345
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    58
    #9
    You have Excellent portfilio :) I might need a logo.. Added to MSN.
     
    RWHost, Jul 21, 2008 IP
  10. Limotek

    Limotek Peon

    Messages:
    165
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Can you please explain how are includes are hackable? The reason I ask is because I use a lot of includes within one of my websites and so I wanted to know how vulnerable it is.
     
    Limotek, Jul 23, 2008 IP
  11. billy786

    billy786 Peon

    Messages:
    323
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #11
    you can include html with the <?php ?> brackets ;)
     
    billy786, Jul 23, 2008 IP
  12. LeetPCUser

    LeetPCUser Peon

    Messages:
    711
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #12
    1. You can save a HTML file as a PHP file. Simple name this file header.php.
    2. Rename your index.html to index.php
    3. Put the include for the header (also not a bad idea to create one for a footer).
    4. Optional: Create a footer.php
    5. Save everything and upload it to your server.

    **Note: Most hosting companies support PHP, but if it does not work they do not. Also, PHP is not like HTML in regard to working remotely. It will not preview from your desktop correctly.

    I hope this helps.
     
    LeetPCUser, Jul 23, 2008 IP
    Soner likes this.
  13. crichton1234Fsj

    crichton1234Fsj Peon

    Messages:
    42
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #13
    better use a master page in asp.net
    its very much simple
    bt ur requirements may vary
    just an suggestion
     
    crichton1234Fsj, Jul 23, 2008 IP
  14. Soner

    Soner Active Member

    Messages:
    479
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    55
    #14
    Should I download PHP to the server first ?
     
    Soner, Aug 10, 2008 IP
  15. ninjacluster

    ninjacluster Peon

    Messages:
    132
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #15
    If you already have everything in HTML and you don't want to go with PHP, you can always use software that will batch find/replace throughout all your files.
     
    ninjacluster, Aug 10, 2008 IP
  16. Soner

    Soner Active Member

    Messages:
    479
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    55
    #16
    Well, I made everything in Html but like I said, I wanted to make footer.php and header.php to make the changes easier at one time. But I uploaded the .php and .html file, but the page is blank.
     
    Soner, Aug 10, 2008 IP
  17. gerdywerdy

    gerdywerdy Member

    Messages:
    381
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    35
    #17
    you could also use css to include a header ise a css stylesheet to include a image as a header

    #banner {
    float : left;
    width : 500px;
    height : 200px;
    margin-left: 125px;
    padding : ;
    margin-bottom : 0;
    background : #eee url(img/image.JPG);

    then if i change the image i dont have to change the html on every page i just change it in the stylesheet
     
    gerdywerdy, Aug 10, 2008 IP
  18. Soner

    Soner Active Member

    Messages:
    479
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    55
    #18
    ye I use css but what about the links on the footer :) ?
     
    Soner, Aug 11, 2008 IP
  19. holidayhoteldirect

    holidayhoteldirect Banned

    Messages:
    154
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #19
    we help professionally
     
    holidayhoteldirect, Aug 11, 2008 IP