Jump to content


Photo

?page=


  • Please log in to reply
16 replies to this topic

#1 Lessur

Lessur
  • Members
  • PipPip
  • Member
  • 26 posts

Posted 28 July 2006 - 05:31 PM

I have seen many sites with somethig like:

www.domainhere.com/?page=news

And then another page like www.domainhere.com/?page=other

How can I do that?  ???

#2 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 28 July 2006 - 05:47 PM

They are get queries
used in universal pages or the like
All it means is
http://www.whatever.com
that is the domain name
http://www.whatever.com/index.php
that is the filename that you are on, the homepage in this case
http://www.whatever....=west&born=1983
That is the domain name, followed by the page they are on
the question mark ends hte actual url information and starts variable information
there just php variables, this becomes
$name = "west";
$born = 1983;
what would be that those values are assigned to those variables on the next page USING the get command
$_GET['name']
$_GET['born']
the first variable contains "west" the second containes 1983
Then you have other symbols for other things, if the variables values contain spaces, you see + for every space, if there are other special characters they automatically get url encoded.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#3 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 28 July 2006 - 05:51 PM

Like you can take and do this with like 20 url's
and have 1 page handle all of those url's based on the contents of the get variables, and have it use the location header to redirect them to the appropriate pages, it can severely cut down on the number of pages on your server.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#4 Lessur

Lessur
  • Members
  • PipPip
  • Member
  • 26 posts

Posted 28 July 2006 - 05:53 PM

I dont really understand.  I am talking about for example a site like http://thesmurk.net/.  When you click on "Flash" for example the new address is http://thesmurk.net/?page=flash

#5 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 28 July 2006 - 05:55 PM

?page=flash
That simply means as I states
the ? ends the actual url information and starts the variables
the variable page is set to teh word flash
$page = flash;
is how you would do it, or how it would look in php.
this probably tells a redirecting page to send it to the flash version of the site, or could be for something else, or something used in the script to decide whether to activate flash or not.  Could be many reasons.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#6 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 28 July 2006 - 05:56 PM

Oh I just checked it,
if it's set to flash it displays the flash elements, if you take it off, the flash elements are x-ed out.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#7 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 28 July 2006 - 05:57 PM

or they could be testing the browser for flash, and if it exists it shows that, if not it doesn't, it could be anythign.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#8 Lessur

Lessur
  • Members
  • PipPip
  • Member
  • 26 posts

Posted 28 July 2006 - 06:00 PM

?page=flash
That simply means as I states
the ? ends the actual url information and starts the variables
the variable page is set to teh word flash
$page = flash;
is how you would do it, or how it would look in php.
this probably tells a redirecting page to send it to the flash version of the site, or could be for something else, or something used in the script to decide whether to activate flash or not.  Could be many reasons.


So basically, in another page there is $page = flash; ?  And when you say www.blah.com/?page=flash it goes to the page that has $page = flash;  in it?

#9 king arthur

king arthur
  • Members
  • PipPipPip
  • Advanced Member
  • 335 posts
  • LocationUK HQ

Posted 28 July 2006 - 06:02 PM

I dont really understand.  I am talking about for example a site like http://thesmurk.net/.  When you click on "Flash" for example the new address is http://thesmurk.net/?page=flash


In your example:

What will happen is that the same page (the one at http://thesmurk.net/) will be loaded. But this time around, a variable will be set in the superglobal array $_GET, with the value "flash".  The script would access this variable by looking at $_GET["page"].

It might use this in a switch statement, e.g.

if(isset($_GET["page"]))
{
switch($_GET["page"])
{
  case "flash":
     .....do some flash stuff.....
  break;
  default:
     .....do something else......
  break;
}
}
Sir Isaac Newton said "If I have seen farther, it is by standing on the shoulders of giants". But it is not recorded as to whether he said it before or after he was hit on the head by a falling apple.

#10 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 28 July 2006 - 06:02 PM

No that sets the variable.
It means that if you set that,
http://www.domain.co....php?page=flash
like if you have in a link
index.php?page=flash
they click on that, on the index.php page if you type out
echo $page;
it's going to say
flash
it just registers the variable with the value for use on the next page.
Even if it's a quick script to see which one was set for redirection.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#11 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 28 July 2006 - 06:03 PM

exacly like he states above.  With that example, that is exactly how I was meaning for redirect. 

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#12 unkownname

unkownname
  • Members
  • PipPip
  • Member
  • 19 posts

Posted 28 July 2006 - 06:05 PM

quick and simple code for you.
EX URL: http://example.com/index.php?id=1
if(isset($_GET['id'])){
$id=$_GET['id'];
}else{
$id=0; //this is not very necessary//
}
switch($id){
case 1:
//EX: This is were the url goes to.//
include("news.php");
break;
case 2:
//EX: Include about//
include("about.php");
break;
default;
//EX : Include home page//
include("home.php");
}

FOR Words just put case 'word': //Make sure it has " ' " because it prob will screw up with " not sure its been a while

#13 Lessur

Lessur
  • Members
  • PipPip
  • Member
  • 26 posts

Posted 28 July 2006 - 06:18 PM

Would that code code into my index.php (My home page.)  or Shoudl I make that code index.php and the old index.php index2.php?  Hehe, sorry but Im a newb when it comes to php  :'(

#14 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 28 July 2006 - 06:37 PM

It has to be applied in the form of a link, there has to be some point when someone clicks on a link to have hte query string there.
You could have a front page, that says click here for flash version, or here for non flash version
non flash version has no code
the other is like
<a href="index.php?page=flash">Flash Version</a>
That sends hte variable
$page = flash
across to the other page, so you can activate the flash or whatever
or you can send to another redirect page
and have
if ($_GET['page'] == "flash") {
$page = "indexwithflash.php";
header('Location: ' . $page);
}else {
$page = "index.php"; // regular index page with no flash
header('Location: ' . $page);
}
Even still you can do something like have the variable disable and enable flash as necessary,

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#15 king arthur

king arthur
  • Members
  • PipPipPip
  • Advanced Member
  • 335 posts
  • LocationUK HQ

Posted 28 July 2006 - 06:38 PM

Would that code code into my index.php (My home page.)  or Shoudl I make that code index.php and the old index.php index2.php?  Hehe, sorry but Im a newb when it comes to php  :'(


What is it that you're actually trying to do?
Sir Isaac Newton said "If I have seen farther, it is by standing on the shoulders of giants". But it is not recorded as to whether he said it before or after he was hit on the head by a falling apple.

#16 Lessur

Lessur
  • Members
  • PipPip
  • Member
  • 26 posts

Posted 28 July 2006 - 06:42 PM

I want to have something like www.domain.com/?page=pagehere.

For example, if I went to my domain.  It would come up on index.php.  And say I have a link to info.  I want to be able to make that link www.domain.com/?page=info.  I also have a link to flash, with, there a link to each persons flash.  I wnat to be able to say www.domain.com/?page=flash&user=usernameofuser .  How can I do such a thing?  I already have all the pages.

#17 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 28 July 2006 - 06:47 PM

That's not going to happen, being limited to just passing get variables.  You need some kind of login if you don't already have one, plus either sessions or cookies.  On top of that you need to pass the variables necessary, and even in this particular situation passing get variables between urls for this, would be pointless, you should automatically generate the url's via db interacting into the session variables, when they first login, and pass that information from page to page, this will save you a lot of time, and a lot of headaches, and be a little more secure. 

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users