Jump to content

[SOLVED] Includes question


GameYin

Recommended Posts

Hah damn been a long time since I've been here..

 

I have this page http://www.devwebsites.com/sitedevs/

 

I get an error when trying to do this

include "default.php?pageTitle=Home";

 

default.php includes the dtd, all the same crap that begins every page. I want a custom <title> though for each page and that is where pageTitle comes in. If I went to index.php where I have include "default.php?pageTitle=Home";, the <title> will read: SiteDevs * Home. Get it?

 

Anyway it's giving me an error on include "default.php?pageTitle=Home";

 

My default.php works just fine because if I go there and manually do it it shows fine.

Link to comment
Share on other sites

here's my theroy:

 

this will not work, as include opens a file from the drive, and doesn't send a url request to a webserver. as a result, putting $_GET variables after the filename will mess you up... the include in your script is looking for a file in the current folder thats actually called "default.php?pageTitle=Home" and not "default.php" and then passing it pageTitle=Home.

Link to comment
Share on other sites

here's my theroy:

 

this will not work, as include opens a file from the drive, and doesn't send a url request to a webserver. as a result, putting $_GET variables after the filename will mess you up... the include in your script is looking for a file in the current folder thats actually called "default.php?pageTitle=Home" and not "default.php" and then passing it pageTitle=Home.

my bad didn't see that part

Link to comment
Share on other sites

Holy crap a lot of replies...

 

I figured out it was going for the literal string. I ended up doing something like this.

 

default.php part

<title>SiteDevs • <? echo $pageTitle; ?></title>

 

index.php part

$pageTitle="Home";

include 'default.php';

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.