dealing with variables
Moderator: General Moderators
dealing with variables
hi, i am working on building a class that would generate html tables. my idea was to pass an array of 'column name' => 'column data' pairs where 'column data' would include html and php variables which were not yet created - they would be created only after the object was instantiated (loading them from a database...). my question is, how do i get variables in the array at first as a string and then later when the variables are actually created, parse them to get their values?
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: dealing with variables
Put the strings in sprintf format or use a templating system. Then you can pass the strings around and insert the value into the string at a later point. You might want to just look into a templating system, or use PHP as a templating system rather than your array of HTML scheme.
(#10850)
Re: dealing with variables
Thanks. i'M going to look into templating engines.Any simple ones that come to mind?
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: dealing with variables
I have seen people mention that they like TemplateLite several times in these forums.
(#10850)