Read php code on string without eval function -


i know eval() in php evaluate php code inside string. create simple template class eval. but, in practice way not comfortable. hard maintain. so, here simple short snippet code example

function render($view,$data)     {         extract($data);         ob_start();         include somepath . 'views/' . $view . ext;         $result = ob_get_contents();         ob_end_clean();          $result = str_replace('<cihtml name="apa">',file_get_contents( somepath . '/views/sample.php' ),$result);          echo eval( '?>' . $result);     } 

i can render it. in case, there problem eval error specific reason.

now, need here concept template parser without eval() function. advance.

why reinvent weel? people use frameworks these kind of things. http://phalconphp.com/ http://docs.phalconphp.com/en/latest/reference/volt.html


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -