For more information about how to inherit the smarty class, see!

Source: Internet
Author: User
What are the problems encountered when inheriting the smarty class !! I copied the libs directory of smarty to the test project. the test project is simple and has two file demos. php and init. inc. php, and then in init. inc. php makes some configuration, such as the delimiter and template directory. if you use this method: PHPcode & lt; to inherit from the problems encountered by the smarty class, please guide me !!
I copied the libs directory of smarty to the test project. the test project is simple and has two file demos. php and init. inc. php, and then in init. inc. php makes some configuration, such as the delimiter and template directory. if this method is used:
PHP code
  
  left_delimiter="
  ";?>
After the configuration is complete, write this in demo. php.
PHP code
  
  assign("title",$title);    $tpl->assign("content",$content);    $tpl->display("default/test.tpl");?>
Show no problem
If the mySmarty code of another class that inherits from the smarty class is as follows, in init. inc. php
PHP code
         
  Smarty();            $this->template_dir="./templates/";            $this->compile_dir="./templates_c/";            $this->config_dir="./configs/";            $this->cache_dir="./cache/";            $this->caching=true;            $this->left_delimiter="
  ";            $this->assign('app_name','mySmartyTest');        }    }       ?>

In demo. php, I make the following calls and displays
PHP code
  
  assign("title",$title);    $tpl->assign("content",$content);    $tpl->display("default/test.tpl");?>
The error 500 will be reported. what is going on? please kindly advise. thank you !!

------ Solution --------------------
If you enable the php error display function, you will know where the problem is.

Inherited
If it is Smarty 2, there should be no big mistake
If it's Smarty 3, it's another thing.
------ Solution --------------------
I have been working for six years, and I will tell you how to give up the smarty unhuman template engine as soon as possible.
------ Solution --------------------
Because it's annoying.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.