Creating Other Pages

Well, .NET is actually different than classic ASP.

ASP (and other backend languages) add functionality / programatic functionality to websites.

Oh ok…

Yes I have PHP so I work out the footer the same way?

Similar, but probably much more involved.

Hopefully you don’t have too many pages.

The likeliest place to start is your “home” or “index” page.

For starters. you can simply give the file the “.php” extension instead of the “.html” extension and make sure it still works.

* and it’s safe to delete “hello” now :wink:

Ok ill get back to you on this a bit later. Thanks.

Creating an include is fairly simple, if it is static, not dynamic, you can just write it in pure html, like this:-

<footer>All the things in my footer here</footer>

And save it as “footer.php” or whatever you like.
Then on your pages, they may be mostly pure html, but saved as .php and have a bit of php thrown in where needed.
I use it like this:-

<?php include $_SERVER["DOCUMENT_ROOT"] . "/includes/footer.php"; ?>

To break that down:
<?php is the opening tag for php and ?> is the closing tag. Everything inbetween is php and can be inserted within your html anywhere you need it.
For an include you simply say: include "filepath and name" ; so it could say:

<?php include "http://www.example.com/footer.php" ; ?>

I use $_SERVER["DOCUMENT_ROOT"] to start at the root. The “.” joins things in php, so the root is appended with what ever I put after the “.” which is "includes/footer.php" because I keep the includes in a sub folder named “includes” to keep things organised. You always end a php command with a “;” at the end.
Of course there is way more you can do with php, but do the basics to start with.

Also, you may want to add a redirect to your .htaccess like this:

RedirectMatch 301 (.*)\.html$ http://www.example.com$1.php

after you have renamed your files from .html to .php otherwise any external links or search results that still point to the .html version will find the old version or 404 if you removed them.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.