{"id":45,"date":"2011-06-29T18:39:13","date_gmt":"2011-06-29T18:39:13","guid":{"rendered":"http:\/\/beta.robertprice.co.uk\/robblog\/2011\/06\/disabling_the_zend_framework_viewrenderer-shtml\/"},"modified":"2011-06-29T18:39:13","modified_gmt":"2011-06-29T18:39:13","slug":"disabling_the_zend_framework_viewrenderer-shtml","status":"publish","type":"post","link":"https:\/\/www.robertprice.co.uk\/robblog\/disabling_the_zend_framework_viewrenderer-shtml\/","title":{"rendered":"Disabling The Zend Framework ViewRenderer"},"content":{"rendered":"<p>\nThere are times when using the Zend Framework that you don&#8217;t want a view to render.\n<\/p>\n<p>\nFor example, you may be generating a feed programaticaly, or you may be using a templating engine such as Twig for some or all paths.\n<\/p>\n<p>\nBy default, the front controller enables the <a href=\"http:\/\/framework.zend.com\/manual\/en\/zend.controller.actionhelpers.html#zend.controller.actionhelpers.viewrenderer\">ViewRenderer action helper<\/a>. It is the job of the ViewRenderer to inject the view object into the controller and to automatically render the view. The idea is that you don&#8217;t need to worry about manually instantiating view objects in your controller, the helper does it for you.\n<\/p>\n<p>\nIt&#8217;s actually very simple to disable this behaviour, and there are several ways to do it.\n<\/p>\n<p>\nFirstly, if you want to disable this functionality across your application, you could use the following in the application.ini file&#8230;\n<\/p>\n<pre class=\"lang:php decode:true \" >resources.frontController.noViewRenderer = true\n<\/pre>\n<p>\nThis can also be set programatically&#8230;\n<\/p>\n<pre class=\"lang:php decode:true \" >Zend_Controller_Front::getInstance()-&amp;gt;setParam('noViewRenderer', true);\n<\/pre>\n<p>\nA better approach would be to simply remove the ViewRenderer helper.\n<\/p>\n<pre class=\"lang:php decode:true \" >$this-&gt;_helper-&gt;removeHelper('viewRenderer');\n<\/pre>\n<p>\nIf you don&#8217;t want the ViewRenderer disabled across your entire application, you can set it locally in a controller&#8230;\n<\/p>\n<p><pre class=\"lang:php decode:true \" >\n$this-&gt;_helper-&gt;viewRenderer-&gt;setNoRender(true);\n<\/pre><\/p>\n","protected":false},"excerpt":{"rendered":"<p>There are times when using the Zend Framework that you don&#8217;t want a view to render. For example, you may be generating a feed programaticaly, or you may be using a templating engine such as Twig for some or all paths. By default, the front controller enables the ViewRenderer action helper. It is the job &hellip; <a href=\"https:\/\/www.robertprice.co.uk\/robblog\/disabling_the_zend_framework_viewrenderer-shtml\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Disabling The Zend Framework ViewRenderer&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[2],"tags":[17,50,81],"class_list":["post-45","post","type-post","status-publish","format-standard","hentry","category-dev","tag-dev","tag-php","tag-zend-framework"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Disabling The Zend Framework ViewRenderer - Robert Price<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.robertprice.co.uk\/robblog\/disabling_the_zend_framework_viewrenderer-shtml\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Disabling The Zend Framework ViewRenderer - Robert Price\" \/>\n<meta property=\"og:description\" content=\"There are times when using the Zend Framework that you don&#8217;t want a view to render. For example, you may be generating a feed programaticaly, or you may be using a templating engine such as Twig for some or all paths. By default, the front controller enables the ViewRenderer action helper. It is the job &hellip; Continue reading &quot;Disabling The Zend Framework ViewRenderer&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.robertprice.co.uk\/robblog\/disabling_the_zend_framework_viewrenderer-shtml\/\" \/>\n<meta property=\"og:site_name\" content=\"Robert Price\" \/>\n<meta property=\"article:published_time\" content=\"2011-06-29T18:39:13+00:00\" \/>\n<meta name=\"author\" content=\"rob\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"rob\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/disabling_the_zend_framework_viewrenderer-shtml\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/disabling_the_zend_framework_viewrenderer-shtml\\\/\"},\"author\":{\"name\":\"rob\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/#\\\/schema\\\/person\\\/fac6d5b076e0e14e1fb13e15b542a6c5\"},\"headline\":\"Disabling The Zend Framework ViewRenderer\",\"datePublished\":\"2011-06-29T18:39:13+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/disabling_the_zend_framework_viewrenderer-shtml\\\/\"},\"wordCount\":177,\"keywords\":[\"Dev\",\"PHP\",\"Zend Framework\"],\"articleSection\":[\"Dev\"],\"inLanguage\":\"en-GB\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/disabling_the_zend_framework_viewrenderer-shtml\\\/\",\"url\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/disabling_the_zend_framework_viewrenderer-shtml\\\/\",\"name\":\"Disabling The Zend Framework ViewRenderer - Robert Price\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/#website\"},\"datePublished\":\"2011-06-29T18:39:13+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/#\\\/schema\\\/person\\\/fac6d5b076e0e14e1fb13e15b542a6c5\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/disabling_the_zend_framework_viewrenderer-shtml\\\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/disabling_the_zend_framework_viewrenderer-shtml\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/disabling_the_zend_framework_viewrenderer-shtml\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Disabling The Zend Framework ViewRenderer\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/#website\",\"url\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/\",\"name\":\"Robert Price\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.robertprice.co.uk\\\/robblog\\\/#\\\/schema\\\/person\\\/fac6d5b076e0e14e1fb13e15b542a6c5\",\"name\":\"rob\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g\",\"caption\":\"rob\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Disabling The Zend Framework ViewRenderer - Robert Price","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.robertprice.co.uk\/robblog\/disabling_the_zend_framework_viewrenderer-shtml\/","og_locale":"en_GB","og_type":"article","og_title":"Disabling The Zend Framework ViewRenderer - Robert Price","og_description":"There are times when using the Zend Framework that you don&#8217;t want a view to render. For example, you may be generating a feed programaticaly, or you may be using a templating engine such as Twig for some or all paths. By default, the front controller enables the ViewRenderer action helper. It is the job &hellip; Continue reading \"Disabling The Zend Framework ViewRenderer\"","og_url":"https:\/\/www.robertprice.co.uk\/robblog\/disabling_the_zend_framework_viewrenderer-shtml\/","og_site_name":"Robert Price","article_published_time":"2011-06-29T18:39:13+00:00","author":"rob","twitter_card":"summary_large_image","twitter_misc":{"Written by":"rob","Estimated reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.robertprice.co.uk\/robblog\/disabling_the_zend_framework_viewrenderer-shtml\/#article","isPartOf":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/disabling_the_zend_framework_viewrenderer-shtml\/"},"author":{"name":"rob","@id":"https:\/\/www.robertprice.co.uk\/robblog\/#\/schema\/person\/fac6d5b076e0e14e1fb13e15b542a6c5"},"headline":"Disabling The Zend Framework ViewRenderer","datePublished":"2011-06-29T18:39:13+00:00","mainEntityOfPage":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/disabling_the_zend_framework_viewrenderer-shtml\/"},"wordCount":177,"keywords":["Dev","PHP","Zend Framework"],"articleSection":["Dev"],"inLanguage":"en-GB"},{"@type":"WebPage","@id":"https:\/\/www.robertprice.co.uk\/robblog\/disabling_the_zend_framework_viewrenderer-shtml\/","url":"https:\/\/www.robertprice.co.uk\/robblog\/disabling_the_zend_framework_viewrenderer-shtml\/","name":"Disabling The Zend Framework ViewRenderer - Robert Price","isPartOf":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/#website"},"datePublished":"2011-06-29T18:39:13+00:00","author":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/#\/schema\/person\/fac6d5b076e0e14e1fb13e15b542a6c5"},"breadcrumb":{"@id":"https:\/\/www.robertprice.co.uk\/robblog\/disabling_the_zend_framework_viewrenderer-shtml\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.robertprice.co.uk\/robblog\/disabling_the_zend_framework_viewrenderer-shtml\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.robertprice.co.uk\/robblog\/disabling_the_zend_framework_viewrenderer-shtml\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.robertprice.co.uk\/robblog\/"},{"@type":"ListItem","position":2,"name":"Disabling The Zend Framework ViewRenderer"}]},{"@type":"WebSite","@id":"https:\/\/www.robertprice.co.uk\/robblog\/#website","url":"https:\/\/www.robertprice.co.uk\/robblog\/","name":"Robert Price","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.robertprice.co.uk\/robblog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Person","@id":"https:\/\/www.robertprice.co.uk\/robblog\/#\/schema\/person\/fac6d5b076e0e14e1fb13e15b542a6c5","name":"rob","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/secure.gravatar.com\/avatar\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6f0eb511179100a4e968abc70403e33686e6ab3e992e392bedd2ccac01da666c?s=96&d=mm&r=g","caption":"rob"}}]}},"_links":{"self":[{"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/posts\/45","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/comments?post=45"}],"version-history":[{"count":0,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/posts\/45\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/media?parent=45"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/categories?post=45"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.robertprice.co.uk\/robblog\/wp-json\/wp\/v2\/tags?post=45"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}