- This topic is empty.
-
AuthorPosts
-
August 26, 2012 at 1:22 pm #39520
hrechkaness
MemberAlright, so I built my site completely using html and css. I am finding that as I’m updating it along the way it is becoming rather laboursome to have to go to every single .html page to modify the header and footer code just so it will function the same. I know you can simplify this using php so you only have to modify the one file and it will automatically update for every page. So I guess my question is how do I go about doing that?
August 26, 2012 at 2:03 pm #108485chrisburton
ParticipantYou need to change your file extensions to .php
So the end result would look like this:
ALL YOUR CONTENT HERE
August 26, 2012 at 3:37 pm #108488hrechkaness
MemberSo let’s say my I change my index.html to index.php. I copy all of my header code and paste it into a header.php file and then add this code to the top of every page?
Will the header code then look something like this?
Whiner Bros
?>I tried experimenting with that and it won’t let me preview the index.php file (probably because it’s not a webpage)
August 26, 2012 at 4:02 pm #108490hrechkaness
MemberAlright, how do I preview the .php files? Whenever I open them in the web they just close and then moves to my download folder.
August 26, 2012 at 4:05 pm #108491chrisburton
ParticipantIs there a reason you’re using XHTML? You can make it even more simple by using the HTML5 doctype (add this to your header.php file):
Whiner Bros
I also noticed your title. You’re going to need a loop to determine the title of the page.
and then to include it for every page, just paste this in your index file(s)
August 26, 2012 at 4:09 pm #108493hrechkaness
MemberI am trying to open them in my browser on my local machine. That is how I have been viewing my .html pages so far as my site isn’t completely live yet.
August 26, 2012 at 4:09 pm #108494chrisburton
ParticipantAugust 26, 2012 at 4:16 pm #108496hrechkaness
MemberI’ll try downloading the Mamp and let you know the results. Looks like it’s going to take a couple minutes to download
August 26, 2012 at 4:19 pm #108498chrisburton
ParticipantAlso, check out this screencast so you have an idea of how it works.
https://css-tricks.com/video-screencasts/86-mamp/August 26, 2012 at 5:01 pm #108500hrechkaness
MemberAlright, MAMP is working properly, but I’m having a problem. I changed my index.html to index.php and placed it in the mamp/htdocs folder. I tested to see if it worked by placing random text into the index.php file and it appeared in the browser so Woot! But when I paste my html code that I had before the page remains completely blank. Not even any < p >text< /p > is showing up. I’m not sure what I should do from here
August 26, 2012 at 5:24 pm #108501chrisburton
Participant@hrechkaness Did you put anything for the root password?
Also, just for kicks, try adding this before the HTML (at the very top of the page)
and then
?>
after the html
August 26, 2012 at 5:54 pm #108502hrechkaness
MemberI don’t believe I put anything for the root password. I tried adding the php code to the beginning and end of my html and when I refreshed my web page I got a server error instead of a blank white page
?>
August 26, 2012 at 6:47 pm #108507chrisburton
ParticipantAdd a root password and see if that changes anything.
What error did it display?
August 26, 2012 at 9:33 pm #108515hrechkaness
MemberI added a root password but it didn’t change anything, here is the error message I’m getting:
http://i50.tinypic.com/zybja0.pngAugust 26, 2012 at 9:40 pm #108516chrisburton
Participant@hrechkaness What happens when you go here? http://localhost:8888/phpinfo.php
Are you also putting the files you’re working on inside htdocs?
-
AuthorPosts
- The forum ‘Back End’ is closed to new topics and replies.