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
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.
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.
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.
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):
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.
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.
You can save a HTML file as a PHP file. Simple name this file header.php. Rename your index.html to index.php Put the include for the header (also not a bad idea to create one for a footer). Optional: Create a footer.php 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.
better use a master page in asp.net its very much simple bt ur requirements may vary just an suggestion
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.
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.
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