December 18, 201015 yr Hi all, First im new to this forum. I'm also new to web design to be prepared for loads of questions. But anyway: Does anyone know if there is a way when you make a website and lets say you wanted to change the header instead of going to every page what would you do it avoid the changing manually is they a way to do it in one page then it does it to the others. Vulcan
December 18, 201015 yr Hi all, First im new to this forum. I'm also new to web design to be prepared for loads of questions. But anyway: Does anyone know if there is a way when you make a website and lets say you wanted to change the header instead of going to every page what would you do it avoid the changing manually is they a way to do it in one page then it does it to the others. Vulcan Im assuming that you are writing each page in HTML. Well there are a couple of ways to do what you want, the most basic way would be to write it in PHP and use the include function. http://www.w3schools.com/PHP/DEfaULT.asP will give you a starting point
December 19, 201015 yr Author Ok thanks for that but will it show how i can to do what i want it to do.
December 19, 201015 yr If you have PHP you can start off with basic file includes, e.g header.html <div id="header"> <h1>My Header</h1> </div> navigation.html <div id="nav"> <ul> <li><a href="/">Option 1</a></li> <li><a href="/">Option 2</a></li> <li><a href="/">Option 3</a></li> <li><a href="/">Option 4</a></li> <li><a href="/">Option 5</a></li> </ul> </div> then to pull your include files into a document, you'd use the include function. mypage.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>My include page</title> </head> <body> <?php include('header.html'); ?> <div> <?php include('navigation.html'); ?> <div>Page content here...</div> </div> </body> </html>
December 19, 201015 yr Note that in the above example the "include" files header.html and navigation.html do NOT have a doctype, html tags, head section or body tags as these would be duplicated in the final processed pag. Just put the html markup in the "include" files. The "include" files can have almost any filename extension like .inc .txt .php .html .htm I prefer to use .inc so that the "include" file are clearly distinguished from proper html files in my folder lists.
December 19, 201015 yr Author Ok ill have a go thanks soo much for that. Do for a bref: I save header, footer and nav as html. When puting it together im put it in a file like Index.php Then have <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>My include page</title> </head> <body> <?php include('header.html'); ?> <div> <?php include('navigation.html'); ?> <div>Page content here...</div> </div> </body> </html>
December 19, 201015 yr or you can use css..... put it as a Background image, then when you wanna update it, all you gotta do it change the filename in the CSS and dimensions of the div its in if necessary..
December 19, 201015 yr Author yeah ok well the problem of useing php is i cant see my work in design view? i have to host it to see it. (I have Adobe Dreamwever CS5)
December 19, 201015 yr well the problem of useing php is i cant see my work in design view? i have to host it to see it. (I have Adobe Dreamwever CS5) Download WampServer 2 or XAMPP which has Apache server and PHPadmin. Load the website into the folder which is targetted by the program (C:\wamp\www folder in WampServer).
December 19, 201015 yr Author yep ok XAMPP Thanks so much aswell is that where to download it form Here Edited December 19, 201015 yr by Vulcan
December 19, 201015 yr WAMP is Mac Only, but XAMPP is Linux, MAC, and Windows So i suggest XAMPP For the record I said WampServer 2 (not WAMP) which is for Windows (it works for me on XP) but if he's chosen XAMPP then taht should be OK. MAMP is the usual software fro a Mac. I'm not sure if WAMP works on a Mac. I think WAMP has been superseded by WampServer 2. http://en.wikipedia.org/wiki/Comparison_of_WAMPs Edited December 19, 201015 yr by Wickham
December 19, 201015 yr ahh fair enough ^^ you should see a folder on your c drive called www, root or wwwroot, not too sure, but that is where you need to put your site
December 19, 201015 yr Author ok well i only see wamp when i click in the folder i can see www. As well the local host in the web browser doent work Edited December 19, 201015 yr by Vulcan
December 19, 201015 yr Yes, it can be difficult to get a PHP server working. I can only speak for WampServer but you should have chosen a default browser for the program when you installed it and you need to open localhost browser through the XAMPP program (in WampServer it's via the system tray icon left click). Then open the folder and file from inside the program (from the index.php page that shows as the localhost web page in WampServer) and open your folder and file from there. In WampServer you can't just double click the file name in a file list like Windows Explorer. Edited December 19, 201015 yr by Wickham
December 19, 201015 yr Author Ok im only going to use the WampServer. And im as well very confusied it take a while for me understand
Create an account or sign in to comment