FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Seeking help with relative and absolute paths
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Seeking help with relative and absolute paths [message #180860 is a reply to message #180859] Fri, 22 March 2013 07:11 Go to previous messageGo to previous message
J.O. Aho is currently offline  J.O. Aho
Messages: 194
Registered: September 2010
Karma:
Senior Member
On 22/03/13 05:24, The Frog wrote:
> Thankyou very much for the replies. I appreciate the help. I have a follow-up question then regarding constants and setting them. If I define a constant say in the sites landing page (eg/index.php) will that constant then remain available for any scripts on pages that follow without having to 'require' them?

<?php
DEFINE('A', true);
include "fileB.php";
?>

In this case the A would exists in fileB.php, but it's a quite iffy way
to do it, as if you include fileB.php from another script which don't
have the define, then the A will be missing and you will end up with an
error. A constant will only exists after it has been defined and will
not remain in memory when you load a new page.

> The reason I ask is one of ignorance on my part. Having consulted the php manual on constants I am unable to make a clear determination on their usage and scope. It would seem in my experimentation and learning that a constant does not in fact remain but in fact needs to be re-defined in each unique page change on the users part. While this can be accommodated in the scripts and pages that I write I am wondering if there is a better way? Define once and use many places?

A constant will not magically live into another page, if you want a
value to be set on pageA and then be accessible on pageB and pageC then
use $_SESSION[]

see: http://www.php.net/manual/en/intro.session.php


--

//Aho
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Fatal error!
Next Topic: Hot list for BA, QA – Analyst, Java Developer, Business Analyst/ Project Coordinator & SAP Business Object Developer
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 22 20:17:23 GMT 2024

Total time taken to generate the page: 0.04065 seconds