Home > Backend Development > PHP Tutorial > How to use smarty advanced features objects, _PHP tutorial

How to use smarty advanced features objects, _PHP tutorial

WBOY
Release: 2016-07-12 09:02:48
Original
810 people have browsed it

How to use the objects of smarty's advanced features,

The examples in this article describe how to use the objects of smarty's advanced features. Share it with everyone for your reference, the details are as follows:

<&#63;php
include_once('smarty.inc.php');
class Dog{
 public $name;
 public function sayHello(){
 echo 'hello';
 }
}
$dog1=new Dog();
$dog1->name="first dog";
$smarty->assign("dog",$dog1);
$smarty->display('test.tpl');
&#63;>

Copy after login

test.tpl file:

属性调用:{$dog->name}<br />
方法调用:{$dog->sayHello()}

Copy after login

Output display:

first dog
hello

I hope this article will be helpful to everyone’s PHP program design based on smarty.

Articles you may be interested in:

  • How to implement infinite classification of smarty templates in php
  • How to implement multi-level classification in smarty
  • How to implement infinite classification in smarty Add foreach-like functions to automatically load data
  • Analyze for-like functions in smarty templates
  • php smarty secondary classification code and template loop examples
  • Convenient and practical PHP Generate static page classes (non-smarty)
  • smarty adodb PHP development mode for some custom classes
  • Categories written specifically for novices combined with smarty

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1084526.htmlTechArticleHow to use objects with advanced features of smarty. This article describes how to use objects with advanced features of smarty. Share it with everyone for your reference, the details are as follows: phpinclude_once('sm...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template