1: 在首页上, 文章里的阅读更多出现 Itemid 错误的问题
方法: 编辑 components/com_content/content.html.php
约400行左右
$_Itemid = $Itemid;
替换为:
$_Itemid = $mainframe->getItemid( $rows[$i]->id, 0, 0 );
约556行左右
$row->_Itemid = $Itemid;
替换为:
if ( $task != 'view' && $task != 'category' ) {
$row->_Itemid = $mainframe->getItemid( $row->id, 0, 0 );
} else {
$row->_Itemid = $Itemid;
}2: [评论里2楼的 july 提供 ]建立 "List - Content Section"类型菜单,设置 “Empty Categories in Section”时,得不到预期效果:将空的Category也显示出来 这主要是由于SQL语句的Left Join 造成的,Left Join没有匹配的,会自动赋值为NULL(b.access 字段), 最后SQL语句执行时为 数值和NULL 的比较。解决的办法如下:
components/com_content/content.php [~344行 ]
$access_check_content = "\n AND b.access <= " . (int) $gid;
替换为:
$access_check_content = "\n AND ( b.access <= " . (int) $gid ." OR b.access is null)";
3: 后台增加菜单时, 查询次数上千次问题的解决方法:
/administrator/components/com_menus/content_item_link.class.php
将:
$query = "SELECT a.id AS value, a.title AS text, a.sectionid, a.catid "
. "\n FROM #__content AS a"
. "\n INNER JOIN #__categories AS c ON a.catid = c.id"
. "\n INNER JOIN #__sections AS s ON a.sectionid = s.id"
. "\n WHERE a.state = 1"
. "\n ORDER BY a.sectionid, a.catid, a.title"
;
$database->setQuery( $query );
$contents = $database->loadObjectList( );
foreach ( $contents as $content ) {
$query = "SELECT s.title"
. "\n FROM #__sections AS s"
. "\n WHERE s.scope = 'content'"
. "\n AND s.id = " . (int) $content->sectionid
;
$database->setQuery( $query );
$section = $database->loadResult();
$query = "SELECT c.title"
. "\n FROM #__categories AS c"
. "\n WHERE c.id = " . (int) $content->catid
;
$database->setQuery( $query );
$category = $database->loadResult();
$value = $content->value;
$text = $section ." - ". $category ." / ". $content->text ." ";
$temp[] = mosHTML::makeOption( $value, $text );
$contents = $temp;
}替换为:
$query = 'SELECT a.id AS value, CONCAT(s.title, \' - \',c.title,\' / \',a.title, \' \') AS text
FROM #__content AS a
INNER JOIN #__categories AS c ON a.catid = c.id
INNER JOIN #__sections AS s ON a.sectionid = s.id AND s.scope = \'content\'
WHERE a.state = 1
ORDER BY a.sectionid, a.catid, a.title';
$database->setQuery($query);
$contents = $database->loadObjectList();
4:两个未过滤的标题的地方:
/components/com_content/content.html.php [~607, 614行]
搜:
<?php echo $row->title;?>
替换为:
<?php echo htmlentities($row->title);?>
5:...
Only registered users can write comments.
Please login or register.