Zymic Forums

Webmaster resources

Zymic IRC Server

Chat in real time at irc.zymic.com - Learn More

Welcome

Welcome to the Zymic webmaster forums. Our forums are here to provide people the free ability to discuss a range of websites related topics such as design, development coding and marketing.

In order to post you will need to register for a zymic account or if you already have one simply login by using the form on the left.

left Zymic Webmaster ForumsWeb Design & DevelopmentServer Side ScriptingPHP right
  Reply to this topic Start new topic
left right
Mortalis9
post Nov 4 2007, 06:20 AM
Post #1


Super Ninja
****

Group: Members
Posts: 357
Joined: 4-November 07
From: Los Angeles
Member No.: 2,317



how do i do this? i found it a while back but i don't remember where it was.

thanks. smile.gif
Go to the top of the page 
 
  + Quote Post
Earpy
post Nov 4 2007, 02:27 PM
Post #2


Newbie
*

Group: Members
Posts: 27
Joined: 19-September 07
From: England, United Kingdom
Member No.: 121



I have posted a similar question which can be found here That's the only help I can give afraid unsure.gif
Go to the top of the page 
 
  + Quote Post
drakkar
post Nov 4 2007, 03:35 PM
Post #3


Newbie
*

Group: Members
Posts: 4
Joined: 5-October 07
Member No.: 964



.../page.php?=aaaaa

Then $_SERVER["QUERY_STRING"] contains "=aaaaa".

Ignore .php is an Apache config command, i dont know if this server has it on.
Go to the top of the page 
 
  + Quote Post
Snarup
post Nov 7 2007, 08:32 PM
Post #4


Newbie
*

Group: Members
Posts: 2
Joined: 7-November 07
Member No.: 2,506



<?php

$variable = $_GET['variable'];

switch($variable) {

default: include('home.php'); break;
case "forum": include('forum.php'); break;

}

?>

Basically the first thing I've done is set a variable to retrieve the information on the other side of the equal sign, by that I mean I am getting the "membercp" out of "www.yoursite.com/index.php?to=membercp". As you can tell my variable used is "to", you can change that to whatever you like by editing the line of code, "$variable = $_GET['variable'];" to "$variable = $_GET['WHATEVER'];".

The switch statement is used to change the output depending on the information on the other side of the equal sign, as you can see there is a "default" and a case of "forum". Simply put, if I were to used the same example as above, when the information comes back as none, the default block of code runs, if the information is "forum" than the block of code relevant to it runs.

I hope this helps, feel free to ask anything you don't understand and I will try to answer you.

Go to the top of the page 
 
  + Quote Post
Colin
post Nov 7 2007, 10:53 PM
Post #5


Marvellous Ninja
******

Group: Members
Posts: 537
Joined: 19-September 07
From: Kansas =\
Member No.: 48



My tutorial on it smile.gif
http://colinsmiley.net/forum/viewtopic.php?t=41
Go to the top of the page 
 
  + Quote Post
Tom
post Nov 8 2007, 03:30 PM
Post #6


Outrageously Uber Ninja
*******

Group: Administrators
Posts: 1,363
Joined: 11-March 07
From: London
Member No.: 7



That's a horrible tutorial.
Go to the top of the page 
 
  + Quote Post
Exo
post Nov 11 2007, 09:29 PM
Post #7


Newbie
*

Group: Members
Posts: 1
Joined: 10-November 07
Member No.: 2,637



this should help
CODE
<?php
if(!isset($_GET['id'])) {
include "homepage.php";
}elseif(!file_exists($_GET['id'].".php")) { // this also takes you to the home page if the page you're looking for using the ?page= dosn't exist
include "404.php";
}else{ //if all goes well
include $_GET['id'].".php"; // include the page e.g if it was ?page=tutorials include tutorials.php
} ;?>
Go to the top of the page 
 
  + Quote Post
MrTouz
post Nov 14 2007, 01:08 AM
Post #8


Outrageously Uber Ninja
*******

Group: Members
Posts: 1,196
Joined: 19-September 07
Member No.: 234



Colin on your tutorial you should add a function in case the page doesnt exist...
Go to the top of the page 
 
  + Quote Post
Erind
post Nov 17 2007, 11:20 PM
Post #9


Newbie
*

Group: Members
Posts: 3
Joined: 17-November 07
Member No.: 3,011



Colin, your tutorial has many mistakes and it isn't much help to the reader.

I usually leave the extensions out. Since my pages are pretty much all .php, I just use the name and add .php in the include function.
Go to the top of the page 
 
  + Quote Post
MrTouz
post Nov 19 2007, 09:51 PM
Post #10


Outrageously Uber Ninja
*******

Group: Members
Posts: 1,196
Joined: 19-September 07
Member No.: 234



someone posted a function where no matter which extension you typed it'll always return the one you asked. lets say you type home.html or home.php or home.so well it'll always return to the home page... if the page was a php than it will always return to the home.php... pretty nice !
Go to the top of the page 
 
  + Quote Post
 Reply to this topic Start new topic
left right
0 Members:
left right
 


Lo-Fi Version Time is now: 21st November 2009 - 09:25 PM