• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

php help

jpsj82

Senior member
i need some help with php. i want to include a file and have that file based on some variable, like the following.

if i have
$id = 'my-test';

i want to include the following
include = 'http://www.mysite.com/~test1/my-test.inc';

how do i do this? is there some string append function in php i can use? because the include line is already in the php quotes i couldn't just put <?php echo $id ?> where i wanted it.

anyone have any ideas, thanks in advance.
 
include = "http://www.mysite.com/~test1/" . $id;

Edit: actually, in your case: include = "http://www.mysite.com/~test1/" . $id . ".inc";

HTH

 


<< include = "http://www.mysite.com/~test1/" . $id;

HTH
>>

ok, i will try this, but just looking at this i will assume it doesn't add the .inc afterwards. My guess is that i just have to do the following:

include = "http://www.mysite.com/~test1/" . $id . ".inc";

i'll try it now.
 
hmm

Parse error on the following

include = "'http://www.mysite.com/~test1/" . $id . ".inc";

any idea what is wrong?
 


<< you have a single and a double quote before http >>

not sure how that got in there - but that is not in my real code
 
ok now i am an idiot - php syntax does not have an = symbol.

so correctly it would be wrote as

include "http://www.mysite.com/~test1/" . $id . ".inc";

thanks everyone
 
Ah, man, you got me.

I did not even check.

It's:
include "http://www.mysite.com/~test1/" . $id . ".inc";

I stupidly copied your equal sign.


BTW, there is no () involved
 


<< $id="http://www.mysite.com/~test1/my-test.inc";
include($id);
>>

thanks for the help, but the problem with this is it might not be my-test it could be my-test2 or my-test3 or anthing. So i need to use the method that RSMemphis gave me.
 
Back
Top