Thinkphp template usage problems in thinkphp combined with the smarty template, all have been configured, in IndexAction. class. $ this-& gt; display (& quot; login & quot;) is used in the PHP file, but DefaultAction is another file. class. if the php file is also used, the following problem occurs: Fatalerror: Ca thinkphp template usage
The smarty template has been configured in thinkphp. class. $ this-> display ("login") is used in the PHP file, but the DefaultAction is another file. class. if PHP files are used in the same way, the following problems may occur:
Fatal error: Call to a member function display () on a non-object in E: \ php \ AppServ \ www \ DLP \ ThinkPHP \ Lib \ Think \ Core \ Action. class. php on line 103
The code for Action. class. php is:
Protected function display ($ templateFile = '', $ charset ='', $ contentType = 'text/html ')
{Echo $ templateFile;
If (false ===$ templateFile ){
$ This-> showTrace ();
} Else {
$ This-> view-> display ($ templateFile, $ charset, $ contentType );
}
}
Have you ever had the same problem? give me some help...
------ Solution --------------------
I have also seen it, because Action uses the constructor.
Function _ construct ()
{
// Content
}
Use in TP
Function _ construct ()
{
Parent: :__ construct;
}