SharkBait Posted May 28, 2007 Share Posted May 28, 2007 In my blog software (custom built) I am curious if I enter <?php include('somefile.php'); ?> within the body of the post that gets put into the database. When it is displayed it won't necessarily display that file correct? I would I assume have to something like bbcode [require]sometime.php[/require] and have the php process it when it sees [require][/require] I'm trying to make it so I can add little modules that I can display different things (like polls) within my content posts etc. Quote Link to comment Share on other sites More sharing options...
Buyocat Posted May 28, 2007 Share Posted May 28, 2007 I'm not entirely sure what you're doing, but if you store some php script in a DB and then pull it out and have it processed as a PHP script then it'll evaluate like you expect. On the other hand if you pull it from the DB and treat it like a string (that is you don't evaluate it) then you're correct in assuming the include will just print on-screen. I think a better solution to your module idea is to store a marker or some set of relevant data in a table and have an object (or script) run with that data on display time. This would complicate your process by adding steps between pulling the data from the table and displaying it, but it would make for more reusable (and perhaps secure) code. Quote Link to comment Share on other sites More sharing options...
knowNothing Posted June 22, 2007 Share Posted June 22, 2007 I know this is a little late in terms of a reply, but eval() is your friend. I think I was looking for the ability to parse php after pulling it out of a database for too long. I knew what I wanted it to do, but didn't know what it was called, and people had no idea what I was talking about, but yea.. eval() is definitely useful. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.