Thank you curly brackets!
Pirata Nervo Offline
Member
***
Posts: 235
Joined: Jan 2008
Post: #5
RE: Thank you curly brackets!
(07-14-2010 11:31 AM)ZiNgA BuRgA Wrote:  Parse

Code:
Hey there Mr. {$test}, please {$message}!

into

PHP Code:
Hey there Mr. <?php echo $values['test']; ?>, please <?php echo $values['message']; ?>!


Then include the file whenever you wish to use it.
IDK if this is for MyBB or not BTW.


No it's not for MyBB, it's for a website I'm creating.

But how would you parse {$test} into <?php echo $values['test']; ?> ? With str_replace? I believe a regex would probably be faster here since the name of the variables and the amount of variables varies from file to file.

But, wouldn't it be better to have <?php echo $values['test']; ?> in the files instead of {$test}? - no replacements needed.

I'm probably not understanding you correctly Tongue

I might take a look at how wordpress does it since I want something similar.
07-14-2010 09:57 PM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
Thank you curly brackets! - Pirata Nervo - 07-14-2010, 04:00 AM
RE: Thank you curly brackets! - Pirata Nervo - 07-14-2010 09:57 PM

 Standard Tools
Forum Jump: