Forums / Setup & design / $module_result.content is empty!

$module_result.content is empty!

Author Message

Matthew Dawkins

Friday 06 May 2011 1:25:29 am

I'm trying to create a new template for my vanilla EZP 4.4.0. I've created the pagelayout.tpl and put it in the correct place, and changed the site.ini.append.php file to use my test design. However, when I try to view my home page it doesn't show any content.

The template is very minimal, for testing purposes, as follows:

!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
<head>
 
<style type="text/css">
    @import url({'stylesheets/core.css'|ezdesign});
    @import url({'stylesheets/debug.css'|ezdesign});
</style>
 
{include uri='design:page_head.tpl'}
 
</head>
 
<body>
<p>Testing.</p>
{$module_result.content}
 
<!--DEBUG_REPORT-->
 
</body>
</html>

In the site.ini.append.php file I have the following:

[DesignSettings]
SiteDesign=minimal

When I view the home page, the template itself loads fine. The header meta content is populated, the fallback stylesheets are imported, my test paragraph is shown, but {$module_result.content} doesn't return anything at all. Why might that be?

If I change the template back to ezwebin my content shows perfectly, so it's not an issue with the page content itself. I've tried modifying the page content and re-saving, but that's not helped either. I've tried clearing all the caches, and that doesn't help. I've created another page in EZP, and that content shows up fine with the above template, so it's only the home page that's having problems. I've tried using {$module_result.node_id} and that correctly shows 2, so $module_result itself is fine. I've also tried {$module_result|attribute(show)}, which displays a complete overview of the whole object, and shows that everything else is fine except the content part, which is an empty string. I've even tried rebooting Apache, in desperation.

So any suggestions as to why {$module_result.content} might be empty, but only for my template? Is there an override setting I've missed?

Marko Žmak

Friday 06 May 2011 1:58:52 am

It seems like template override problem, maybe the override template used to render the homepage is empty. Try identifying which override template is used for displaying homepage by using DebugOutput and ShowUsedTemplates ini settings. And then loook at the content of this template.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Matthew Dawkins

Friday 06 May 2011 2:06:07 am

The debug information tells me that two templates were used to render the page:

1 pagelayout.tpl <No override> design/minimal/templates/pagelayout.tpl    
1 setup/debug_toolbar.tpl <No override> design/standard/templates/setup/debug_toolbar.tpl    

That's as I expected, and that first one is the template shown in my original post. As I say, the rest of the template is loading fine, it's just the $module_result.content that isn't.

Marko Žmak

Friday 06 May 2011 3:30:37 am

Try clearing all the cache and then reloading the page. You should have a larger list of used templates then.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Matthew Dawkins

Friday 06 May 2011 3:51:01 am

Actually no, I shouldn't. The only templates that should be used are the minimal pagelayout.tpl as shown above, the page_head.tpl fallback (which I haven't changed or overridden), and debug_toolbar.tpl. There really is nothing else going on here. In fact, I've now removed the page_head.tpl, just in case, so the only thing I'm using is my own page_layout.tpl.

I'm still not convinced it's a template issue, because the template as a whole is working fine (and I've done other tests to confirm that it's working). The issue here is the $module_result.content doesn't actually contain any data.

Is there another way of getting the page content, other than $module_result.content?

Matthew Dawkins

Tuesday 10 May 2011 7:46:28 am

I've done some more digging around, and the rest of the site appears to be unaffected by this problem - it's only the home page that is empty.

Furthermore, I can confirm that $module_result itself is being generated, and I can get to most of the attributes inside it. However, the content attribute is not being filled. I've been playing around with overrides, but since the content isn't being filled nothing I did would show anything anyway! $module_result.path isn't being populated either, I notice.

Could it be a corrupted database? Or a siteaccess setting that's wrong? Any help would be appreciated.