Hello everyone, I have a quite complicated problem. I am using template files to edit a script. It has symbols with special meaning like {$clientsarea.firstname} etc I need to put these in php coding. But they are processed after the php tags. Currently i am using something like the following, but its not working. <?php $link = mysql_connect($server, $user, $pass); if(!mysql_select_db($database)) die(mysql_error()); $id = '{$clientsdetails.id}'; ?> Code (markup): I want the sybmol {$clientsdetails.id} to be processed by the template engine and then that info is stored in $id. Is there any way of doing this?? I need this fixed quick. Thanks, Hassan
As I understand it, the value {$clientsdetails.id} isn't replaced with the actual value (say, "foo"), until after HTML is printed? I'm thinking the best way to do it is to use PHP to save the actual value of {$clientsdetails.id} in a file named "clientsdetails.txt" or whatever, then use a server side include to run another PHP file. I think you can include php with ssi..?
Try to use ob_start() function like this: <?php function callback($buffer) { if(preg_match('/<id>(.*?)<\/id>/si',$buffer,$regs)){ $id=$regs[1]; // here you get the variable that you can store anywhere } return $buffer; } ?> <id>{$clientsdetails.id}</id> Code (markup): Good luck
I think buffering the output is what i needed. I will try it soon. Thanks very much to all for helping. Rep+ given.