Jump to content

[SOLVED] Using a $GET['link'] function on my home page, and $GET['page'] on my photo page


DigitalDrew

Recommended Posts

 

Hey guysNgals,

 

I'm a newber to more advanced PHP (well anything other than the $GET and include function  :shrug: )

Just graduated from college (May 09) Trying to get my online portfolio up and I'm stuck :facewall:

I'm in total need of assistance, I'm in  :wtf: mode... (I love these emoticons, if you haven't already noticed  :thumb-up:  ) Ok onward...

 

 

I'm using this for my navbar to dynamically retrieve the guts of my pages, works fine, like always.

 

<?php if($_GET['link'])

 

{

include ('pageheading/' . $_GET['link'] . '.php');

}

else

{

include ('pageheading/home.php');

}

 

?>

 

 

 

<div id="top_navbar">

 

<ul id="menu">

<li><a href="/" class="home" >home</a></li>

<li><a href="?link=about" class="about" >about</a></li>

<li><a href="?link=web" class="web">web</a></li>

<li><a href="?link=photo" class="photo">photo</a></li>

<li><a href="?link=video" class="video">video</a></li>

<li><a href="?link=contact" class="contact">contact</a></li>

 

</ul>

</div>

 

Now I want to use this function:

 

<?php

 

if($_GET['page'])

{

include ('flickr/' . $_GET['page'] . '.php');

}

else

 

{

include ('flickr/FSU.php');

}

 

?>

 

 

on my "photo" page to dynamically retrieve my flickr photosets with:

 

 

  <ul>

<li><a href="/?link=photo?page=FSU"  title="Florida State University, Around the Campus">Florida State University</a></li>

<li><a href="?link=photo&?page=Miami" title="South Miami">South Miami</a></li>

<li><a href="?link=muscles" title="muscles">Muscles</a></li>

<li><a href="?page=CG_Images" title="CG">CG Images</a></li>

<li><a href="?page=facial_textures" title="Photoshop Textures">Facial Textures</a></li>

</ul>

 

 

I have saved them as embedded flash [objects] inside separate .php files in a folder called flickr, which is inside the 'pageheading'.

 

Here are paths to two separate embedded flash objects:

http://www.andrewmichaelnathan.com/pageheading/flickr/FSU.php

http://www.andrewmichaelnathan.com/pageheading/flickr/Miami.php

 

 

As soon as I click on a link ON my 'photo page' to retrieve one of the embedded flash objects, it says:

 

Warning :'( include(pageheading/photo/?page=Miami.php) [function.include]: failed to open stream: No such file or directory in /home/content/d/i/g/digitaldrew/html/index.php on line 51

 

Warning :'( include() [function.include]: Failed opening 'pageheading/photo/?page=Miami.php' for inclusion (include_path='.:/usr/local/php5/lib/php') in /home/content/d/i/g/digitaldrew/html/index.php on line 51

 

I tried everything  :wtf:  ,

I've never been able to use the $GET function on the home page, and another $GET function on a page that was retrieved by the first $GET function, to dynamically GET other data.

 

View source code @ http://www.andrewmichaelnathan.com/?link=photo

 

If you can help me realize :facepalm: what I'm doing wrong, it would be much appreciated!

 

Thank You!

AMN

 

 

Hi,

assuming that the code that you have pasted is your actual code, you have a problem with the vars attached to the url as you have added an extra "?"  in there:

/?link=photo?page=FSU

As I am sure you know, seperate variables should be seperated by "&" so that link should be:

/?link=photo&page=FSU

 

Chris

:o YES!  Chris, thank you so much!!

I did not know that an ampersand was needed, or the back-slash,

I guess I over looked that last night at 1,2,3am while looking it up on W3schools.

I've never added 2 $GET functions in one web page.

Thanks again Chris :D!

AMN

The back slash is not actually needed, I was just quoting a part of your url.

 

In general terms, in an url, only the first "?" is read as meaning "variables to follow" after that is is regarded as part of the variable name or value.

As you now know, the ampersand (&) is used to seperate diferent variables and the "=" to define the value of each variable.

 

Chris

 

 

I have to say that I just started to implement the code, and it wasn't working, so I went back to the post and the answer to my question was in your second reply.  So, I have to thank you again  :D

YOU ARE GREAT!  :happy-04:

AMN

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.