Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to add a new page to your script
09-12-2011, 12:43 PM
Post: #1
How to add a new page to your script
In this tutorial I will show you how to properly add a new page to your script,
when I say properly I mean; it will have the same url structure as other pages.
Quote:http://www.domain.com/?option=newpage

I will also show you how to add a line into your htaccess file for this new page so that you can have a link like;
Quote:htt://www.domain/com/newpage

First, adding our page.

1. Open the /include/functions.php file.

2. Do a text search for
Quote:switch ($_GET['option']) {

3. Under that line, is where we are going to add our new page. Here is an example;
Code:
case "newpage":
return '<h1 class="title">New Page Title</h1>
          <center>New Page Content.</center>';
break;

Second, adding a link to this page in the menu.

1. Open the /include/functions.php file.

2. Do a text search for
Quote:function call_menuler()

3. This is our menu function, you should be able to see the structure it uses with ul and li, here is an example of adding our new page;
Code:
function call_menuler() {
global $root_url,$lcl;
return '<li><a href="'.$root_url.'">'.$lcl['homepage'].'</a></li>
<li><a href="'.$root_url.'">'.$lcl['videos'].'</a></li>
<li><a href="'.$root_url.'?option=popular">'.$lcl['popularvideos'].'</a></li>
<li><a href="'.$root_url.'?option=games">'.$lcl['games'].'</a></li>
<li><a href="'.$root_url.'?option=populargames">'.$lcl['populargames'].'</a></li>
<li><a href="'.$root_url.'?option=contact">'.$lcl['contact'].'</a></li>
<li><a href="'.$root_url.'?option=newpage">New Page</a></li>';
}

Now, you have the new page, and a menu link.
Next we will add a line to the htaccess file for a neater url. (The htaccess file that is in your root_dir)

Third, adding to htaccess.

1. Open .htaccess file.

2. Add this line to the file (edit for your own page name
Code:
RewriteRule ^newpage /?option=newpage [NC]

Note:
You shouldnt have to, but if it doesnt work the first time, try clearing your cache files.

Custom HTML/CSS/PHP
http://theorderofindividualacceptance.co...p.php?id=1
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
How to add a new page to your script - Punktured - 09-12-2011 12:43 PM

Forum Jump: