php - tp template inheritance problem
给我你的怀抱
给我你的怀抱 2017-05-27 17:43:33
0
1
552

Use tp3.3 to create a background management system. I tried using tp's template inheritance and encountered a problem.
Example:
Add administrator method:

public function addC(){
    echo "1234";
    $this->display();
}

$this->dispaly();Displayed template page:
<extend name="./Application/Rbac/View/base.html" />
<block name=" content">
Form...
</block>

Problems encountered:
echo "1234"; cannot be displayed. I also have no way to var_dump($_POST) the data submitted by the form. This should be related to the mechanism of tp template inheritance. How should I modify the code? Thank you.

给我你的怀抱
给我你的怀抱

reply all(1)
小葫芦

public function addC(){

$t =  "1234";
$this->assign('t',$t);
$this->display();

}

Template page
<!DOCTYPE html>
<html lang="en">
<head>

<meta charset="UTF-8">
<title>Title</title>

</head>
<body>
<p>{$t}</p> //1234 will be displayed here
</body>
</html>
As for the form submission For data, ajax is usually used, and a new saveC method is created in the background to receive form data and complete the warehousing operation

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!