Well the bottom line is that eval() start's in PHP script mode. If you want to start in HTML mode you need to prefix your string with "?>". In order to support the latter you'd need to add a new function or add an argument to eval(). I think both aren't a good idea.
Andi At 11:27 AM 10/2/2001 -0600, Chris Newbill wrote: >If it is called HTML mode then yes, but if there happened to be PHP in the >string it would be processed as PHP code. I'll assume that is what HTML >mode does??? > >-Chris > > >-----Original Message----- >From: Andi Gutmans [mailto:[EMAIL PROTECTED]] >Sent: Tuesday, October 02, 2001 2:37 AM >To: Chris Newbill; PHP DEV >Subject: RE: [PHP-DEV] include() like functionality for strings > > >I must have misunderstood you. Weren't you asking for an eval() which >starts PHP in HTML mode instead of PHP code mode? > >Andi > >At 06:06 PM 10/1/2001 -0600, Chris Newbill wrote: > >Why would we have to pass it another argument? We don't pass an argument >to > >include() to tell it whether or not it is HTML. > > > >There has to be somesort of mechanism that include is using to parse the > >file/execute any PHP inside it. So basically all we would be doing is > >elimanting the file I/O part of include and going straight to the > >parsing/executing of the string we pass. > > > >This would probably be best as a new function. I'm not sure how it would > >affect BC if eval was modified to handle this. > > > >-Chris > > > >-----Original Message----- > >From: Andi Gutmans [mailto:[EMAIL PROTECTED]] > >Sent: Monday, October 01, 2001 5:55 PM > >To: Chris Newbill; PHP DEV > >Subject: Re: [PHP-DEV] include() like functionality for strings > > > > > >There is no problem in getting it to work but the question is if we can do > >it in a nice way. > >How would eval() know if it's evaling something which should start in a PHP > >or HTML context? You'd have to send it another argument. This would start > >being a bit ugly. > >Is it such a big deal? > >Andi > > > >At 05:15 PM 10/1/2001 -0600, Chris Newbill wrote: > > >Not sure what discussion has been done on this subject before, but here >it > > >goes. > > > > > >I wan't to be able to use a function that does the same thing as include, > > >except instead of passing a file name I pass the actual string to be > > >processed. This differs from eval() because the string may be all HTML. > > > > > >I've seen numerous hacks on how to get this functionality out of eval() > >such > > >as prepending ?> and appending <? to your string, and creating temp files > >to > > >include, etc. But this is somewhat ugly. > > > > > >I'm certain this function could be made easily, and if no one wants to do > >it > > >simply point me in the direction where to find the code for > > >include()/include_once() and I'm sure I can make something work. > > > > > >-Chris > > > > > > > > >-- > > >PHP Development Mailing List <http://www.php.net/> > > >To unsubscribe, e-mail: [EMAIL PROTECTED] > > >For additional commands, e-mail: [EMAIL PROTECTED] > > >To contact the list administrators, e-mail: [EMAIL PROTECTED] > > >-- >PHP Development Mailing List <http://www.php.net/> >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]