Jump to content

Recommended Posts

Hi,

 

I would like to know whether there is a sure way of using the 'include' command so that I don't have to put absolute paths for calling of any files?

 

Alternative is there any other way of directing the PHP parser to a different file if (e.g.) an 'if' condition is executed and the result takes the parser to another file.

 

Example

 

if(storesession($email,1)==TRUE)

{

include ('../home.php');// This doesn't work even though the file is on the upper level.

}

else

{

echo "Create Session Error<br/><br/>";

echo mysql_error();

}

 

Also I need to know whether using the header () command will send the parser to a whole page all together since I am using a template based site i.e. all my pages load on the index page.

Thanks

i'm slightly confused by your question

 

and include, includes a file into the code, so if that file contains php code that code will be parsedm, as if it was in that file directly..

so yes you can use an if statement, yes headers will be parserd (that means if you use Header('location: xyz.com') your be redirected to xyz.com it will not read inn xyz.com.

 

Thanks for your reply

 

Just to clarify,

 

the home.php within the include command isn't located and therefore an error is generated. I was asking whether there was one sure way of inserting a path in the include command which will enable the parser to locate the file I am referencing without having to put in an absolute path.

 

Thanks

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.