Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > PHP eval help

PHP eval help
Thread Tools
Mac Enthusiast
Join Date: Nov 2001
Location: Washington, DC 20009
Status: Offline
Reply With Quote
May 12, 2003, 11:13 AM
 
If I am using PHP to pull in text for my website, I figured using eval() would be the way to have PHP function calls stored in the text string executed at run time. I'm, however, having trouble getting it to work.

Here is a quick layout of how I have things working. There are several text files that contain '::' seperated values (i.e. - [DATE]::[TEXT]::[USER]). My PHP code goes through each of the files and grabs/displays the information. Now, in one of the [TEXT] blocks, I have a call to a function ePoll(). It looks something like this: [start_text]Blah Blah Blah. Blah Blah. ePoll(2)[stop_text]. The call to ePoll(2) should create a poll. It works fine on the page if I don't include it in the text.

How would I go about getting the code to execute? I've done this once before, so I know it's possible. I tried chaging ePoll(2) to eval("ePoll(2);");, but that didn't work either.

Any help is appreciated. Thanks.
Just my $.02 :-)
Ti Powerbook 1Ghz w/ Superdrive ......and lovin' it! :)
     
Forum Regular
Join Date: Apr 2003
Location: Illinois, USA
Status: Offline
Reply With Quote
May 12, 2003, 07:14 PM
 
Devsyn Development Studio: it tastes great and goes down smooth!
     
milf  (op)
Mac Enthusiast
Join Date: Nov 2001
Location: Washington, DC 20009
Status: Offline
Reply With Quote
May 13, 2003, 07:25 AM
 
Yes, I saw that already. I followed the examples, but something still isn't right. Here is the code contained in one of my text files.
[php]<? $str = "ePoll(2);"; eval("$str");[/php]
Still no luck with that though. It doesn't give me any errors, so I imagine it's either correct syntax or just not being executed at all. I'm more concerned with figuring out the latter.

Thanks.
Just my $.02 :-)
Ti Powerbook 1Ghz w/ Superdrive ......and lovin' it! :)
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 03:32 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2