need link changing code

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
max196
Forum Newbie
Posts: 7
Joined: Fri Oct 10, 2008 3:44 am

need link changing code

Post by max196 »

I have over 500 pages on my Game website. Now, I want to place a top-10 games section in each page. I will change top10 links weekly. Is there any php code so that The only top 10 content of all pages changes simultaneously. :?: Please Help Me!

Thank You!
User avatar
mattcooper
Forum Contributor
Posts: 210
Joined: Thu Mar 17, 2005 5:51 am
Location: London, UK

Re: need link changing code

Post by mattcooper »

Sounds like you want an "included" file here:

Code: Select all

 
<?php
    //main file
   echo "<h1>My main page</h1>";
   require_once ('/path/to/top10.php');
?>
 
Put that call on all of your pages and then you'll only need to edit the 'top10.php' file - all pages will receive the update immediately.
max196
Forum Newbie
Posts: 7
Joined: Fri Oct 10, 2008 3:44 am

Re: need link changing code

Post by max196 »

Thank You, for your precious suggestion! :D

But my problem is that, all my pages are in html format & i want to use the same html format pages. I don't want to change my all pages to .php extension. Can i use this php code in my html pages?

Still, I want to create a simple column of top 10 list in right side of each page. Otherwise, suggest me any other best method.

Thank You!
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: need link changing code

Post by aceconcepts »

Yes you can use PHP code in HTML page. Simply type it like this:

Code: Select all

<?PHP include"file.php"; ?>
However, how is you site structure? How are pages called?
Post Reply