![]() |
Parsing Conditions? Eval?
I have a standalone system where users enter HTML, and I want to have some conditions in it (such as hide left block if that option is enabled). Basically in the HTML they will have something like this:
HTML Code:
<table align="center" cellpadding="0" cellspacing="0" width="760"> I'm thinking eval (but I've never used much of it before), so how would I go about doing this with the IFs? Right now I am using preg replace, so if the condition they enter is false, it replaces the condtiions with <!-- and --> (very cheap solution) and if true, replaces with "". I do not want this like vBulletins, where it runs any PHP they enter in the conditions, only presets. |
/me bumps this thread
|
Let's say you had:
PHP Code:
PHP Code:
PHP Code:
- Zero Tolerance |
Hmm, I didn't know about the templatecache thing.. neat:)
Anyway I may have misunderstood, but I don't think that will help. The HTML that is being parsed is not powered by vBulletin (just stored in db). $somevariable = HTML Code:
<table align="center" cellpadding="0" cellspacing="0" width="760"> |
Ah, not vb, i see, well lets say your variable for the template was "$mytemplate", you'd replace all instances of "$vbulletin->templatecache['YOUR_TEMPLATE']" with "$mytemplate", and instead of:
PHP Code:
PHP Code:
- Zero Tolerance |
What would the difference between standard $var = val; and the eval?
The users are the ones inputing the conditions, how would I do it as you are suggesting? |
All times are GMT. The time now is 03:03 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|