Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,471
There are 1436 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     PHP and MySQL :

PHP Page includes..

Thread title: PHP Page includes..
Closed Thread  
Page 2 of 3 < 1 2 3 >
    Thread tools Search this thread Display Modes  
01-12-2006, 04:57 AM
#11
blindchild02 is offline blindchild02
blindchild02's Avatar
Status: TF Veteran
Join date: Jan 2005
Location:
Expertise:
Software:
 
Posts: 3,258
iTrader: 2 / 100%
 

blindchild02 is on a distinguished road

  Old

so.... case "page5" ... would turn any text saying page5 into page5.html??

or do i have to set the link to something?

01-12-2006, 05:04 AM
#12
B72 is offline B72
Status: Sin Binner
Join date: Jan 2006
Location:
Expertise:
Software:
 
Posts: 83
iTrader: 0 / 0%
 

B72 is on a distinguished road

  Old

you can also use a "PHP Navigation" and use Mod-Rewrite.

01-12-2006, 05:15 AM
#13
blindchild02 is offline blindchild02
blindchild02's Avatar
Status: TF Veteran
Join date: Jan 2005
Location:
Expertise:
Software:
 
Posts: 3,258
iTrader: 2 / 100%
 

blindchild02 is on a distinguished road

  Old

Originally Posted by B72
you can also use a "PHP Navigation" and use Mod-Rewrite.
still lost,
im not a programmer (php and such) lol

01-12-2006, 06:09 AM
#14
B72 is offline B72
Status: Sin Binner
Join date: Jan 2006
Location:
Expertise:
Software:
 
Posts: 83
iTrader: 0 / 0%
 

B72 is on a distinguished road

  Old

Originally Posted by blindchild02
still lost,
im not a programmer (php and such) lol
PHP Code:
<?
if(file_exists("$page.php")){ 
include(
"$page.php");
} else { 
include(
"default.php"); 
}
?>
That is your navigation code above, now you can make it so its like this:
yourdomain.com/page/about/

instead of like this:
yourdomain.com?page=about

by using this:
RewriteRule page/(.*)/ /index.php?page=$1

That above code is in the file .htaccess , so you can add it there.

hope i helped you out.

PS. you need to direct link your images though!

This will increase your SEO too

01-12-2006, 07:08 AM
#15
sletts02 is offline sletts02
sletts02's Avatar
Status: Online
Join date: Nov 2005
Location: Brisbane, Auustraaaliiaaaa
Expertise:
Software:
 
Posts: 1,279
iTrader: 0 / 0%
 

sletts02 is on a distinguished road

Send a message via MSN to sletts02

  Old

PHP Code:
<html>
<head>
<title>First PHP Page!!! Yay!</title>
</head>
<body>
My content is below:
<?php
switch($id)
{
/*
Default means this is the default page that is included. 
For example, when someone types blindfate.com they will have the 
home.php page included. 
*/
  
default:
    include(
'home.php');
  break;


/*
Case means what will appear when you type the url in to the browser. 
Example, if  I wanted the "the_website_page.php" to load I would type:
index.php?id=websites
*/
  
case "websites":
    include(
'the_website_page.php');
  break;

/*
Once again, if you want to link to the page called form_send_pro.php 
then you simply type <a href="index.php?id=contact">Contact Us</a>
*/
  
case "contact":
    include(
'form_send_pro.php');
}
?>
</body>
</html>
I hope that explains it, the yellowy/orange can be a little hard on the eyes though.

01-12-2006, 04:19 PM
#16
blindchild02 is offline blindchild02
blindchild02's Avatar
Status: TF Veteran
Join date: Jan 2005
Location:
Expertise:
Software:
 
Posts: 3,258
iTrader: 2 / 100%
 

blindchild02 is on a distinguished road

  Old

thanks, ill give it a shot :]

01-12-2006, 07:50 PM
#17
Nirvana- is offline Nirvana-
Status: Member
Join date: Sep 2005
Location: United States
Expertise:
Software:
 
Posts: 286
iTrader: 0 / 0%
 

Nirvana- is on a distinguished road

  Old

yeah, sletts02 explained it very well.
and thanks for that rewrite snippet B72, might use that..
although, i would advise against using that php script for your includes, as it is insecure and prone to sql injections, etc.

01-12-2006, 08:06 PM
#18
blindchild02 is offline blindchild02
blindchild02's Avatar
Status: TF Veteran
Join date: Jan 2005
Location:
Expertise:
Software:
 
Posts: 3,258
iTrader: 2 / 100%
 

blindchild02 is on a distinguished road

  Old

which one?

01-12-2006, 08:10 PM
#19
Nirvana- is offline Nirvana-
Status: Member
Join date: Sep 2005
Location: United States
Expertise:
Software:
 
Posts: 286
iTrader: 0 / 0%
 

Nirvana- is on a distinguished road

  Old

I, personally, wouldnt use B72's php include, although it does check to see if the file exists, it doesnt provide much more, for your situation, it sounds like you would be fine using the switch statement.

01-12-2006, 08:15 PM
#20
blindchild02 is offline blindchild02
blindchild02's Avatar
Status: TF Veteran
Join date: Jan 2005
Location:
Expertise:
Software:
 
Posts: 3,258
iTrader: 2 / 100%
 

blindchild02 is on a distinguished road

  Old

alright

Closed Thread  
Page 2 of 3 < 1 2 3 >


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed