来自 joomla 模块的 SEF url
我正在制作一个模块,并试图找出如何从该模块获取文章的搜索引擎友好 url
这是今天的帮助程序类
public function getItems($amount)
{
$db = &JFactory::getDBO();
$query = 'SELECT * FROM `#__content`, `#__content_frontpage` WHERE `#__content_frontpage`.content_id = `#__content`.id AND `#__content`.state = 1 ORDER BY `#__content`.publish_up DESC LIMIT ' . $amount . '';
$db->setQuery($query);
$items = ($items = $db->loadObjectList())?$items:array();
return $items;
} //end getItems
这是显示内容的 default.php
<ul class="frontpage_news">
<?php foreach ($items as $item) { ?>
<li>
<div class="frontpage_date"><?php echo JText::sprintf('DATE_FRONTNEWS', $item->publish_up); ?></div>
<div id="ffTitle" class="frontpage_title"><a href="#"><?php echo JText::sprintf('TITLE_FRONTNEWS', $item->title); ?></a></div>
<div id="ffRead" class="frontpage_readmore"><a href="#"><?php echo JText::sprintf('READ_MORE_FRONTNEWS'); ?></a></div>
</li>
<?php } ?>
</ul>
那么我如何获得每篇文章的正确链接以SEF格式显示?
感谢您的帮助!
I am making a module and trying to figure out how to get the Search engine friendly url to articles from this module
this is the helper class today
public function getItems($amount)
{
$db = &JFactory::getDBO();
$query = 'SELECT * FROM `#__content`, `#__content_frontpage` WHERE `#__content_frontpage`.content_id = `#__content`.id AND `#__content`.state = 1 ORDER BY `#__content`.publish_up DESC LIMIT ' . $amount . '';
$db->setQuery($query);
$items = ($items = $db->loadObjectList())?$items:array();
return $items;
} //end getItems
And this is the default.php to display stuff
<ul class="frontpage_news">
<?php foreach ($items as $item) { ?>
<li>
<div class="frontpage_date"><?php echo JText::sprintf('DATE_FRONTNEWS', $item->publish_up); ?></div>
<div id="ffTitle" class="frontpage_title"><a href="#"><?php echo JText::sprintf('TITLE_FRONTNEWS', $item->title); ?></a></div>
<div id="ffRead" class="frontpage_readmore"><a href="#"><?php echo JText::sprintf('READ_MORE_FRONTNEWS'); ?></a></div>
</li>
<?php } ?>
</ul>
So how do I get the correct link to each article displayed in SEF format?
Thanks for any help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于 Joomla 1.5:
对于 Joomla 1.6/1.7:
For Joomla 1.5:
For Joomla 1.6/1.7: