Jump to content

PHP Code


nemxu

Recommended Posts

Hey there,

Right I am going to try and explain this the best way I can. Hopefully you will understand what I am trying to say :D

When I was very much into websites I had a PHP code which enabled me NOT to change every single page when I add a new link to the main page. For example I had the index.html with all the links and the main content... Now where the main content is there used to be a PHP code, which links to the other pages. So for example... when I wanted to upload contacts.php all I would have to do is write what I want for that page with the PHP code at the top and it used to link it with the main page, but just change the main content.

It sounds complicated or maybe I don't Know how to explain myself, however all help would greatly be appreciated... Thanks
Link to comment
https://forums.phpfreaks.com/topic/36099-php-code/
Share on other sites

index.php:
[code]
<html>
<body>
This is my site!
I have links here.
<a href="index.php?page=contacts">Contacts</a>

<?php
if($_GET['page'] == "contacts") include("contacts.php");
else include("news.php");
?>

That's my content, thanks for visiting.
</body></html>[/code]


That style that you're talking about, and that I showed, requires the famous "page=" type of navigation. My personal opinion is that this style navigation is complete garbage, but it is not my site.

I prefer making header and footer files, and then including them on each php page.
Link to comment
https://forums.phpfreaks.com/topic/36099-php-code/#findComment-171376
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.