Parsing jdoc:include elements in error.php

310 views
Skip to first unread message

Matt Thomas

unread,
Sep 2, 2011, 7:43:27 AM9/2/11
to joomla-de...@googlegroups.com
Howdy Folks,

I've been wondering if anyone knows how difficult it would be to extend Joomla to parse jdoc:include elements in files like error.php? Any chance that it could even traverse files like a modal.php as well? 

I ask as I think this would be a very beneficial feature for the future 3.x version of Joomla. Any thoughts?

Best,

Matt Thomas
Founder betweenbrain
Phone: 203.632.9322
Twitter: @betweenbrain


Rouven Weßling

unread,
Sep 2, 2011, 7:52:59 AM9/2/11
to joomla-de...@googlegroups.com

On 02.09.2011, at 13:43, Matt Thomas wrote:

I've been wondering if anyone knows how difficult it would be to extend Joomla to parse jdoc:include elements in files like error.php? Any chance that it could even traverse files like a modal.php as well? 

I think not parsing it in error.php was done intentionally prevent problems that would keep error pages from rendering.

As for modal.php, what file are you referring too?

Rouven

Matt Thomas

unread,
Sep 2, 2011, 8:10:00 AM9/2/11
to joomla-de...@googlegroups.com
I'm not sure if I fully understand the reasoning for not parsing it, as we can work around it and render modules in error.php (and other files) using the technique presented at http://forum.joomla.org/index.php/viewtopic.php?p=1077558#p1077558 (link was broken last time I checked) :

$renderer   = $doc->loadRenderer( 'modules' );
$raw = array( 'style' => 'raw' );
<?php echo $renderer->render('header', $raw, null);  ?>

Where we get stuck are the head elements, which need to be manually recreated. Take a look at the Beez error.php files to see what I mean.

Modal.php is an example of a file found in some templates used for only modals.

Best,

Matt Thomas
Founder betweenbrain
Phone: 203.632.9322
Twitter: @betweenbrain




--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To post to this group, send an email to joomla-de...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-gene...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/joomla-dev-general?hl=en-GB.

Sam Moffatt

unread,
Sep 4, 2011, 4:33:57 AM9/4/11
to joomla-de...@googlegroups.com
What if we don't have a database connection. How do you get the
modules? What if those modules then trigger what ever caused the error
to begin with?

Sam Moffatt
http://pasamio.id.au

Matt Thomas

unread,
Sep 4, 2011, 3:37:28 PM9/4/11
to joomla-de...@googlegroups.com
In that scenario, I'd suggest that rendering any jdoc:include type="modules" statements be rendered as nothing (stripped out) so then at least their containing elements are rendered. Rendering the containing elements is what I do to preserve the page design. You can an example at http://1-6.joomlaengineering.com/index.php/this-is-a-404-error

What do you think?

Best,

Matt Thomas
Founder betweenbrain
Phone: 203.632.9322
Twitter: @betweenbrain




Sam Moffatt

unread,
Sep 4, 2011, 3:43:45 PM9/4/11
to joomla-de...@googlegroups.com
But how do we know when to do that? The DB not being connected is
reasonably detectable but what if the same module (perhaps a search
module) is the source of the problem and is also convenient on your
error page. I feel we're over complicating something that should be a
quick exit or rethink the way we push through errors to provide
different pathways for truly exception errors (bail as quickly as
possible) versus an error case like 404 or similar that is reasonably
recoverable.

Cheers,

Sam Moffatt
http://pasamio.id.au

Matt Thomas

unread,
Sep 4, 2011, 4:09:08 PM9/4/11
to joomla-de...@googlegroups.com
That's a great question. Although it would be very cool to be able to create custom a error page for exception errors, maybe we leave that scenario as it is and bail as quickly as possible, i.e. the "Database Error: Unable to connect to the database:Could not connect to MySQL" message. I'd say the occurrence of those errors are less frequent that a 404, for example.

However, in the case of recoverable errors like a 404, it would be extremely useful to handle the parsing of jdoc:include statements, contained in a template's error.php file. like we do in the index.php file. Specifically, rendering the modules and the head would be a real benefit to template devs.

Could this even be done in commonly used template files like modal.php, component.php, offline.php ...etc? 

Best,

Matt Thomas
Founder betweenbrain
Phone: 203.632.9322
Twitter: @betweenbrain




Reply all
Reply to author
Forward
0 new messages