Jump to content

Recommended Posts

 

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.

 

:)

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.

  • 4 weeks later...

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.