| 12:30 pm on Sep 5, 2004 (gmt 0)|
is that a constant? spaces in a constant might cause a problem
if it stops working when you move to another dir you are having a path problem of some kind.
| 9:13 pm on Sep 5, 2004 (gmt 0)|
no SITE SITE is a link to my site it's an http: .com so I can't put it. the directory is in the main directory so it's (my site)/top.php
yet it refuses to work.
| 9:33 pm on Sep 5, 2004 (gmt 0)|
Why do you put in a absolute URI? ("http://www.(yoursite).com/script.php")
Try a relative URI: "./script.php"
| 12:00 am on Sep 6, 2004 (gmt 0)|
Someone told me u have to have the full url in order for the php to read it.
| 12:18 am on Sep 6, 2004 (gmt 0)|
Actually, they probably meant the "full path", not absolute. The full path is usually something like /user/public_html/this_is_root/
Your best bet is to use this syntax:
include($_SERVER['DOCUMENT_ROOT'] . 'test.php');
| 2:21 am on Sep 6, 2004 (gmt 0)|
I know the problem... it's not reading the variable.
I call up /v5/top.php.
In that file is a variable called $main. this variable has this info:
$main = '<div align="left"><img src="/images/top.gif" alt="Top Image"></div>';
Then the content page tells it this:
$top = '$main';
Then the template calls up this:
Now I dunno if that's the right thing. So far it's outputting $main, then displays the rest of the page.
It used to show the banner that it is supposed to. Now after i get the directory behind it... it doesn't want to. So what can possibly be the problem?
Oh ya I also had it call up an old page of mine and it displayed that fine (But it had no variable and it complained about that, but it's showing it).
And i dunno what ur code meant birdman.. u gotta reallly simplify it to almost exactly how i gotta put it lol.
| 3:47 am on Sep 6, 2004 (gmt 0)|
I'm not sure if you actually have single quotes or not, but the variable won't be parsed unless it is enclosed in double quotes.
$top = "$main";
| 8:27 am on Sep 6, 2004 (gmt 0)|
Well I didn't know about that, what about if i have echo $content. So far all my content is inclosed by ' and it's not causing any errors. It's alot easier then using "
Anyway now I have this:
$title = "My Title";
$top = "$guardian";
Easy, simple and also not the complete thing (content missing from my example). The error on the page reads (i hope this is ok):
Warning: main(/v5/top.php): failed to open stream: No such file or directory in C:\Inetpub\accounts\mm.intellstat\v5\index.php on line 2
Warning: main(): Failed opening '/v5/top.php' for inclusion (include_path='.;c:\php4\pear') in C:\Inetpub\accounts\mm.intellstat\v5\index.php on line 2
Notice: Undefined variable: guardian in C:\Inetpub\accounts\mm.intellstat\v5\index.php on line 6
So it can't find the file when it's /v5/top.php
and if that file isn't included it can't find the variable. I dunno what to do to fix this anymore... ideas?
| 12:21 pm on Sep 6, 2004 (gmt 0)|
OK, I didn't quite mean it that way. The most important feature of double-quoted strings is the fact that variable names will be expanded. You can do variable assignment without quotes, too.
$top = $main;But when you are using a variable in a quoted context, it won't get parsed within single quotation marks. Have a read of the Strings [php.net] page of the PHP manual for more information.
Going back to your bigger problem here...try setting the path back to the path that you believe is working for the include. Then, at the top of the included file, do a simple statement, such as
exit('You made it here!');If your script stops and the message is displayed, we've confirmed that your include is working and we'll move on to variable scope [php.net] to try and figure out what's happening to your variable.
| 3:27 pm on Sep 6, 2004 (gmt 0)|
i made the variable "main" into exit('You made it here!');
but taht didn't work, i also put it under the <? and that didn't work. It's just not finding it. In my older layout this method is fine, when I put the url (full) it acts fine like nothing is wrong, but now it's jsut being a pain.
| 8:34 pm on Sep 6, 2004 (gmt 0)|
the host of the server told me how to fix this just now. I just use relative links (../v5/top.php) and it'll be just fine.