[joomla] Blog content lead story on shows intro
Hans C. Kaspersetz
hans at cyberxdesigns.com
Sun Feb 18 13:08:50 EST 2007
I am working on a Joomla 1.0.12 stable website today and I seem to have
run into some unexpected behavior. When I set 1 story to be lead, 1 to
be intro and 4 of links in a Blog - Content Category, all I get is 2
intros and 4 links. By the way the number of lead and intro stories is
arbitrary. If I set it to 2 and 1, I get three intros. The first story
is not the full text. My expectation is that the lead story is supposed
to be full text, the intro shows intro and the links are links. Is my
expectation correct?
An examination of the source shows that Joomla is not selecting the full
text, it selects the length of it and then stores that in
$row->readmore. However, down in the show() function, Joomla is
expecting the $row->fulltext variable to be set. Is this a feature or a
bug? Anyone else having these problems?
Select from line 801 in content.php.
// Main data query
$query = "SELECT a.id, a.title, a.title_alias, a.introtext,
a.sectionid, a.state, a.catid, a.created, a.created_by,
a.created_by_alias, a.modified, a.modified_by,"
. "\n a.checked_out, a.checked_out_time, a.publish_up,
a.publish_down, a.images, a.urls, a.ordering, a.metakey, a.metadesc,
a.access,"
. "\n CHAR_LENGTH( a.fulltext ) AS readmore, s.published AS
sec_pub, cc.published AS sec_pub, u.name AS author, u.usertype, s.name
AS section, cc.name AS category, g.name AS groups"
. $voting['select']
. "\n FROM #__content AS a"
. "\n LEFT JOIN #__categories AS cc ON cc.id = a.catid"
. "\n LEFT JOIN #__users AS u ON u.id = a.created_by"
. "\n LEFT JOIN #__sections AS s ON a.sectionid = s.id"
. "\n LEFT JOIN #__groups AS g ON a.access = g.id"
. $voting['join']
. $where
. "\n ORDER BY $order_pri $order_sec"
;
From show function expecting full text, ~ line 1718:
// show/hides the intro text
if ( $params->get( 'introtext' ) ) {
$row->text = $row->introtext . ( $params->get( 'intro_only' ) ?
'' : chr(13) . chr(13) . $row->fulltext);
} else {
$row->text = $row->fulltext;
}
Additionally, for some reason, 'intro_only' is hard coded as 1. So
there is no way to get the full text in the blog.
As a solution, I patched content.php in two places to make it work.
First, I have to set 'intro_only' to 0 when I am calling show() in in
the lead story conditional. Then I set it back to 1.
------------ Line 1256 in content.php ------------
$params->set( 'intro_only', 0 ); // We need to set this so that
show will include full text
show( $rows[$i], $params, $gid, $access, $pop ); // Original and
unchanged!
$params->set('intro_only', 1); // We need to turn it back off, so that
intro stories only have intro text.
------------- End snip ----------------
Then I need to modify the content select to get the full text:
------------- Line 801 in content.php -----------------
// Just added a.full text to select. Hans
// Main data query
$query = "SELECT a.id, a.title, a.title_alias, a.introtext,
a.sectionid, a.state, a.catid, a.created, a.created_by,
a.created_by_alias, a.modified, a.modified_by,"
. "\n a.checked_out, a.checked_out_time, a.publish_up,
a.publish_down, a.images, a.urls, a.ordering, a.metakey, a.metadesc,
a.access,"
. "\n CHAR_LENGTH( a.fulltext ) AS readmore, a.fulltext, s.published
AS sec_pub, cc.published AS sec_pub, u.name AS author, u.usertype,
s.name AS section, cc.name AS category, g.name AS groups"
. $voting['select']
. "\n FROM #__content AS a"
. "\n LEFT JOIN #__categories AS cc ON cc.id = a.catid"
. "\n LEFT JOIN #__users AS u ON u.id = a.created_by"
. "\n LEFT JOIN #__sections AS s ON a.sectionid = s.id"
. "\n LEFT JOIN #__groups AS g ON a.access = g.id"
. $voting['join']
. $where
. "\n ORDER BY $order_pri $order_sec"
;
--------------- End snip ---------------
I tried all the settings in Joomla, I think this is a real bug. But I
would love someone else's opinion on the topic.
Thanks,
Hans
More information about the Joomla
mailing list