Добро пожаловать на форум PHP программистов!
За последние 24 часа нас посетили 20610 программистов и 978 роботов. Сейчас ищет 701 программист ...

{method(arguments,#quoted arguments#)}

Вернуться к: HTML_Template_Flexy

{method(arguments,#quoted arguments#)}

{method(arguments,#quoted arguments#)} – creates a PHP method call, and echos the results

Synopsis

Usage ( {method()} , {method():h} , {method():u} , {object.method()} , {method(with.a.variable)} , {method(with.multiple,variables)} , {method(with.variables,#and strings or literals#)} )

creates an PHP method call, any with any number of arguments, as variables or literals (quoted in #). the return value is echoed, and passed by a modifier (like variables)

  • No Modifier - does htmlspecialchars($variable)

  • :h - echos without any change - eg. raw

  • :u - echos urlencode($variable)

Example

Including another template

            class example_page {     var $masterTemplate = "master.html";     var $bodyTemplate =   "body.html";          function ucfirst($string) {         return ucfirst($string);     }          function includeBody() {         $template = new HTML_Template_Flexy();         $template->compile($this->bodyTemplate);         $template->outputObject($this);     } }

Calling includeBody in template, and ucfirst

     {ucfirst(#this is the header#)}  {includeBody():h}  Footer Goes Here.

Compiled template

                  <?php echo htmlspecialchars($t->ucfirst("this is the header")); ?>  <?php echo $t->includeBody(); ?>  Footer Goes Here.

Output from the code

          This is the header  Hello World  Footer Goes Here.


Вернуться к: HTML_Template_Flexy

© 2024 «PHP.RU — Сообщество PHP-Программистов»
Главная | Форум | Реклама на сайте | Контакты VIP Сувениры
Разработка компании ODware