Page 1 of 1

$entry.has_extended, $is_single_entry, $entry.is_extended

Posted: Wed Feb 17, 2010 5:32 pm
by Don Chambers
Had some template logic that was not working as expected and decided to take a closer look at these smarty vars. I viewed these variables with extended body existing, and not existing, as well as overview and detailed page views.

Everything worked as expected except one thing - $entry.is_extended is never true if extended body does not exist. Why?

It seems $is_single_entry is true when viewing the extended entry (ie, entry body, extended body, comment form)..

Code: Select all

No Xbody overview, No Xbody detailed, Yes Xbody overview, Yes Xbody detailed:
$entry.has_extended: null, nulll, 1, 1
$is_single_entry: null, 1, null, 1
$entry.is_extended: null, null, null, 1
This came up in the following context, found in many entries.tpl:

Code: Select all

{if $entry.has_extended and not $is_single_entry and not $entry.is_extended}
Truth is only one or the other of thse last two "and not" is necessary. The way this works, one cannot be true and the other false. They are both always false or always true if extended body exists.

Based on wording alone, I would like to see $entry.is_extended=true (1) for any detailed page view regardless of whether or not extended body exists... but at that point, it probably becomes redundant with $is_single_entry.

Either way, seems there may be one too many smarty vars in there, or there is some use for these I have yet to encounter. :wink:

Hope the above makes sense - cannot draw much of a chart here! :wink:

Re: $entry.has_extended, $is_single_entry, $entry.is_extended

Posted: Thu Feb 18, 2010 10:39 am
by garvinhicking
Hi!

$entry.is_extended is only set when an entry has an extended body. If you want to check on the detail view, you should rely on $is_single_entry.

The extra checks there actually shows output when an entry has an extended body on the overview page, so the "if" clause is NOT meant to tell "this is an detail page", but "this is an entry with extended body on the overview page".

Regards,
Garvin