/    Sign up×
Community /Pin to ProfileBookmark

Variable from a.include not avail in b.include

I am using the following:
a.include——–
<?php
$BASE_HREF=”http://www.yahoo.com“;
?>

b.include——-
<?php
echo $BASE_HREF;
?>

webpage.php—-
<html…
<?php
include(‘a.include’);
echo $BASE_HREF //echo returns [url]http://www.yahoo.com[/url]
include(‘b.include’); //returns nothing
?>
</html>

What can I do to make the vars in a.include available in b.include?

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@jacen6678authorAug 06.2003 — This is no longer a problem... more of a curiosity. On my webpages, a template includes 2+ files.


-----variables.lib----------

<?php

$BASE_HREF="http://a.b.com";

?>

------content.display-----

<img src="<?php echo $BASE_HREF; ?>/images/some.jpg">

If I use:

----------template----------

<?php

include('library/variables.lib');

include('content.display');

?>

then everything works perfectly

If I use:

----------template----------

<?php

include('library/variables.lib');

include($BASE_HREF.'content.display');

?>

then content.display will still be replaced with an image but $BASE_HREF becomes NULL. Anyone know why that is?
×

Success!

Help @jacen6678 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.12,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...