
November 4th, 2004
02:01 PM
Neverside Newbie
Status: Offline!
echo inside a include
im trying to echo some info into a include statement, this is what i got:
<?php
$url_path = "http://someurl.com/";
if ($page == "home") {
include('about.htm');
}
?>
i want to echoe the url_path into the include, ie
<?php
$url_path = "http://someurl.com/";
if ($page == "home") {
include('[b]<echo right here>[/b]about.htm');
}
?>

November 4th, 2004
02:27 PM
<?php
$url_path = "http://someurl.com/";
if ($page == "home") {
include('$url_pathabout.htm');
}
?>
or take away the trailing slash..
<?php
$url_path = "http://someurl.com";
if ($page == "home") {
include('$url_path/about.htm');
}
?>
Is there some kind of problem with doing this that I don't see?
but if home is the index page, you may want to put
if (($page == "home") or ($page =="")) { code }
___________________

Last edited by MinDFreeZ, November 4th, 2004 02:30 PM (Edited 1 times)

November 4th, 2004
03:37 PM
Skip all that and use exactly what D A wrote. Learn from it to so you know for the future how to do it.
Look at the dot in between $url_path and '/about.htm'. The dot connects $url_path to '/about.htm' when it is parsed. There isn't much more to it, re-read what i just said a few times if it doesn't.

November 4th, 2004
03:47 PM
I put
Is there some kind of problem with doing this that I don't see?
because I wanted the answer D A and Nem just said.. that's useful info right there..
altho i tested it, and my way works.. his way does the same thing, and is more efficient/correct.
___________________


December 3rd, 2004
03:12 PM
Neverside Newbie
Status: Offline!
using this code, is there a way to change the action from getting the attribute from inside the code instead of the url
$banner = $_GET["banner"];
//this gets the query string from the url!
if ($banner == "tall") {
include($url_path.'assets/inc/banner-tall.php');
}
else if($banner == "short") {
include($url_path.'assets/inc/banner-short.php');
}
if i put this at the top of the file, is there an easy way to change that code?