开发者

problem baking view in cakephp

开发者 https://www.devze.com 2022-12-15 21:02 出处:网络
I\'ve created a custom view template (see link below), which I\'m using to bake my views in cakephp. http://book.cakephp.org/view/789/Modify-default-HTML-produced-by-baked-templates

I've created a custom view template (see link below), which I'm using to bake my views in cakephp.

http://book.cakephp.org/view/789/Modify-default-HTML-produced-by-baked-templates

Everything works fine, but if I try to incorporate an element in my view template, such as

<?php echo $this->element('menu'); ?>

I get an error while baking the view. If I comment out this line, baking works fine.

This is not a huge problem as I can easily comment out the 开发者_开发知识库line and edit the views after baking them - I'm just curious why this happens.

EDIT

The error I get in bake is something like "Notice: Undefined property: ViewTask::$element in C:\xampp\xampplite\htdocs\company\app\vendors\shells\templates\views\index.ctp on line 87 ('menu')" - I guess it must be a problem with bake trying to interpret $this->element('menu') rather than just echoing it.


You're exactly right:

"I guess it must be a problem with bake trying to interpret $this->element('menu') rather than just echoing it."

So echo it, e.g.

<?php echo "<?php echo \$this->element('menu'); ?>"; ?>
0

精彩评论

暂无评论...
验证码 换一张
取 消