PDA

View Full Version : So, my programmer is asleep...



Shawn
03-02-2007, 04:16 PM
My programmer is asleep and I want to do some work on a site of mine.

I don't know anything about programming. Absolutely nothing. I just want to setup something simple so I can write some info on each state:

<?php include("folder/<? echo $safe_state ?>"); ?>

I took that echo command from higher up in the page, where $safe_state calls the abbreviation of a state. I want to setup a flat include file (SC.inc, FL.inc) for each state and have the page call it's appropriate file.

<? echo $safe_state ?> by itself shows the right abbreviation for the state, but when I put it in the above include -- nothing shows. Even though I've checked and re-checked the directory path several times, it just shows up blank (even though there is content in the state file I'm calling).

Why won't that PHP include above work?

-- Sorry for the ignorance. I don't build sites myself :)

rpanella
03-02-2007, 04:24 PM
<?php include("folder/$safe_state.inc"); ?>

The since you are already in php code you don't want the <? ?> you had in there.
________
Volkswagen taro (http://www.toyota-wiki.com/wiki/Volkswagen_Taro)

Shawn
03-02-2007, 04:54 PM
But I'm not already in PHP code. I'm out of code when I'm putting that.

Any other ideas?

Westech
03-02-2007, 05:00 PM
Try this:



<?php include("folder/" . $safe_state); ?>


or possibly



<?php include("folder/" . $safe_state . ".inc"); ?>

Shawn
03-02-2007, 05:07 PM
Westech wins. Thanks. :)

rpanella
03-02-2007, 05:15 PM
My code is the same as his, so I'm not sure how it didn't work?

What I meant by that was that you were using the PHP tags (<? and ?>) within a set of PHP tags.
________
Creampie Vagina (http://www.****tube.com/categories/475/vagina/videos/1)

Chris
03-02-2007, 06:42 PM
The <? tells the server to start parsing PHP the ?> tells it to stop parsing PHP. So you'll never have a <? and another <? without a ?> in between. I'm suprised the script even functioned.

Shawn
03-02-2007, 07:02 PM
Oh. I think I have everyone confused. It works. It works well.

That's all.

polspoel
03-03-2007, 03:30 AM
btw, it's best if you name your includes .inc.php so they don't show the plaintext source if someone knows the URL.. Or just make sure your includes are not in public_html