method for creating PHP templates (ie html with variables)?

后端 未结 6 515
北恋
北恋 2021-02-04 21:22

I\'m designing my html emails, these are to be a block of html containing variables that i can store in a $template variable.

My problem comes with the storing in the va

6条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-04 21:54

    If you are not against using a framework piece for this, go for Zend_View.

    With Zend_View you can write your templates in pure PHP, and it also comes with lots of helpers to generate HTML output.


    You could also use the include() and extract() functions to create your own template mechanism :

    $model = array('foo' => 'bar', 'baz' => array('bat', 'qux'));
    extract($model);
    include('template.php');
    

提交回复
热议问题