One quarter English
One quarter English

Creating a blank page layout template in eZ Publish

March 27th, 2010

Every page you visit in eZ Publish uses the PageLayout File to create the structure of the page. For XML or AJAX based content you do not always want this to be the case. To get around it, you can add a new layout without a pagelayout template associated with it.

Update: Since writing this article, I’ve become aware of an extension which handles the XML and JSON formatting for you. Depending on the purpose of the blank page layout, you may want to look at using the ggxmlview extension. This provides you with the xml and json formatted pages for nodes and their children.

Create a .ini file in your siteaccess (settings/siteaccess/MY_SITE) called layout.ini.append.php (or if you have already created this add the settings to the file which is already there) and enter the following content:

[xml]
PageLayout=
ContentType=text/xml

If you do not want to set the content type (e.g. if it is for AJAX based content), remove the ContentType line.

You can then access the new pagelayout by setting it explicitly in your url by prepending your path with layout/set/xml/

For example:

www.onequarterenglish.co.uk/sports-news

would become…

www.onequarterenglish.co.uk/layout/set/xml/sports-news

Hiding debug in your blank page layouts

Although hiding the pagelayout is great, there is still an issue which exists if you have Debug Output turned on (since this content is not xml or javascript based. If eZ Publish finds in your template, the debug content replaces this (if not it is simply added to the end of your output. Therefore to get around this, add Javascript or XML comments around :

For Javascript…

/*<!–DEBUG_REPORT–>*/

…or for XML:

<!–<!–DEBUG_REPORT–>–>

Tags: , ,

Leave a Reply

(will not be published)