Unstoppable Domains

What now?

Spacemail by SpaceshipSpacemail by Spaceship
Watch
I

ilike75i

Guest
Guest
Been doing PHP for about a week, but I cant really see how I'm going to incorperate it into my website you know? Like it all looks well but what the tutorials have taught me to do doesnt really seem of much use.

Like what benefits does a site in PHP have? And what potential does PHP have? LIke, for example, I want something so that when I add a link to my nav bar, it will add the same link to the rest of my pages so i dont have to do each page individually?

Just general direction is what i need
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
What you're thinking of above is a template.

Have something like this in header.html:
Code:
<html>
<head>
<title>Title</title>
</head>
<body>

<table>
<tr><td>Corner</td><td>Header</td></tr>
<tr><td>All your menu code here</td><td>

And in footer.html:
Code:
</td></tr>
<tr><td colspan=2>&Copyright Your Name Here</td></tr>
</table>

</body></html>

And then for every page you have, use this PHP:
Code:
<?php

require_once ('header.html');

The content of the particular page goes here. 

require_once ('footer.html');

?>

Then whenever you change the menu code, or anything in either header.html and footer.html, it will be effective over all pages in your website. There are obviously more uses you can make of PHP. Think about what input you might need from your visitors, and what you need to do with it...

I hope that helped,
Shorty.
 
0
•••
Thanks!

Thats what i was looking for, small problem though

Heres my inital page:

Code:
<html>
<head>
</head>
<body>

<?php

require_once ('ab.html');

?>

</body>
</html>

And heres the file titled ab.html:

Code:
<html>
<head>
</head>
<body>

<font color="red">Test</font>

</body>
</html>

But when I run that, i get a blank page?

Thanks

EDIT: Sorry for being such a noob :)
 
0
•••
Remove
<html>
<head>
</head>
<body>

and

</body>
</html>

from ab.html
 
0
•••
Still I get nothing :S
 
0
•••
ilike75i said:
Still I get nothing :S
Do you get an error?

Try this instead:
include('ab.html');

Let us know :), best of luck!
Rhett.
 
0
•••
Try just a plain require statement or an include statement, maybe?
 
0
•••
I don't get an error, just a totally blank page.

the initial page is now:

Code:
<html>
<head>
</head>
<body>

<?php

include('ab.html');

?>

</body>
</html>

and ab.html is simply:

Code:
<font color="red">Test</font>

I read in a tutorial that ab.html should be called ab.php? I tried it but it still didnt work
 
0
•••
Did you save my code as a .PHP file?

Are you running PHP on the server you're testing it on?
 
0
•••
Shorty, you just made me realise what I did wrong. I saved the inital file as .html instead of .php, it works now!

Thanks for your help guys! :D
 
0
•••
No problem, glad I could help. ;)
 
0
•••
Dynadot — .com Registration $8.99Dynadot — .com Registration $8.99
Appraise.net

We're social

Unstoppable Domains
Domain Recover
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back