Page 1 of 1

dealing with variables

Posted: Thu May 01, 2008 2:40 pm
by yshaf13
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?

Re: dealing with variables

Posted: Thu May 01, 2008 3:02 pm
by Christopher
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.

Re: dealing with variables

Posted: Thu May 01, 2008 3:36 pm
by yshaf13
Thanks. i'M going to look into templating engines.Any simple ones that come to mind?

Re: dealing with variables

Posted: Thu May 01, 2008 3:46 pm
by Christopher
I have seen people mention that they like TemplateLite several times in these forums.