Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 12-21-2005, 09:16 PM PHP Includes
Flame's Avatar
Skilled Talker

Posts: 97
Location: Florida, USA
Trades: 0
Hi. I have been wondering this for a while now, and I want to use it... I see on some sites how a link will go to id=main/linkus ... I know it's a PHP include, but how do I insert it just like that into one of my pages? I use PHP includes just so that all my navigation categories show, but how do I do this for every page?
__________________
Flame
Webmaster at:
Please login or register to view this content. Registration is FREE
Flame is offline
Reply With Quote
View Public Profile Visit Flame's homepage!
 
 
Register now for full access!
Old 12-22-2005, 12:07 AM
TrentonD's Avatar
Ultra Talker

Posts: 253
Location: Calgary, Alberta, Canada
Trades: 0
Please refer to this thread:

http://www.webmaster-talk.com/php-fo...php-pages.html

If that doesn't answer your question, please feel free to post here or there!
__________________
Signature Coming Soon! :)
Please login or register to view this content. Registration is FREE
TrentonD is offline
Reply With Quote
View Public Profile Visit TrentonD's homepage!
 
Old 12-22-2005, 08:10 AM
Flame's Avatar
Skilled Talker

Posts: 97
Location: Florida, USA
Trades: 0
I read it, but I'm confused lol I'm a noobie with PHP, let alone coding. I need like step-by-step instructions on how to do this lol Please help if able
__________________
Flame
Webmaster at:
Please login or register to view this content. Registration is FREE
Flame is offline
Reply With Quote
View Public Profile Visit Flame's homepage!
 
Old 12-22-2005, 10:50 AM
akratellio's Avatar
Experienced Talker

Posts: 30
Location: Berlin Germany Europe World
Trades: 0
hi Flame,

if I'm right you're looking for something like this:

Code:
<a href="<?php print $PHP_SELF.'id=linkurl1'; ?>" >link1</a>
<a href="<?php print $PHP_SELF.'id=linkurl2'; ?>" >link2</a>
<a href="<?php print $PHP_SELF.'id=linkurl3'; ?>" >link3</a>
Code:
<?php
if($_GET['id']){  // id is not emtpy
   
    @include("./".$_GET['id']); // when u use this the url will be searched on
                                        // your server (only), with this u can prevent 
                                        // that somebody try to start foreign urls
 

?>
mfg
akratellio
__________________
I'm always lying...
Ich lüge immer...

Please login or register to view this content. Registration is FREE
akratellio is offline
Reply With Quote
View Public Profile Visit akratellio's homepage!
 
Old 12-22-2005, 05:09 PM
TrentonD's Avatar
Ultra Talker

Posts: 253
Location: Calgary, Alberta, Canada
Trades: 0
When it comes down to this, there are a lot of different ways of doing it, and its all in a users preference. Some may be better, some may be worse, but here's how I do it:

This is the code for your links:
HTML Code:
<a href="index.php?ID=NAME1">Link for Name1.php</a>
<a href="index.php?ID=NAME2">Link for Name2.php</a>
Obviously, you can change "ID" to whatever you want (keeping in mind it will need to be changed in the below code), and NAME1 should be the filename of the page you want, not including the extension. (about.php would be "about").

Here's the PHP code to display the content:
PHP Code:
    <?php
    
if(isset($id)){              // Obviously, if you used something instead of "id"
    
include("$id.php");       // up above, you'd change the "id" here to the same thing.
    
}
    else{
    include(
"home.php");   // This is the page to include if no links have been selected.
    
}
    
?>
I hope you understand my method. You don't need to use it, but hopefully it is clear, and not confusing. This is the way I was taught, and I have always used it.
__________________
Signature Coming Soon! :)
Please login or register to view this content. Registration is FREE
TrentonD is offline
Reply With Quote
View Public Profile Visit TrentonD's homepage!
 
Old 12-23-2005, 09:43 AM
Flame's Avatar
Skilled Talker

Posts: 97
Location: Florida, USA
Trades: 0
Thanks for the replies guys! I'll give this a shot today or tomorrow at the latest, and get back to you.
__________________
Flame
Webmaster at:
Please login or register to view this content. Registration is FREE
Flame is offline
Reply With Quote
View Public Profile Visit Flame's homepage!
 
Reply     « Reply to PHP Includes
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.23152 seconds with 12 queries