Set indent on view in Zend Framework

流过昼夜 提交于 2020-01-04 05:45:10

问题


In Zend Framework, it is possible to set indentation for headMeta(), headLink(), etc:

<?= $this->headLink()->setIndent("\t\t") ?>

I like this. I like things tidy. So, now I would want to indent my entire view as well in the layout.phtml file, causing every new line in the view script to be indented with X tabs.

<?= $this->layout()->setIndent("\t\t")->content ?>

This does not work. Is there any way to do this within Zend Framework without having to intercept the output with ob_start?


回答1:


Zend_Layout has no setIndent(), check here: http://framework.zend.com/apidoc/1.11/_Layout.html#Zend_Layout You have to take care of the indentation by yourself in your template.

A generic solution would be to use Tidy with Zend Framework. The options to use then would be

indent => true
indent-spaces => 4


来源:https://stackoverflow.com/questions/6022676/set-indent-on-view-in-zend-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!