脚本宝典收集整理的这篇文章主要介绍了php – 从外部脚本访问Joomla 2.5以获取id的文章,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
define( '_JEXEC',1 ); define( '_VALID_MOS',1 ); define( 'JPATH_BASE',realpath(dirname(__FILE__))); define( 'DS',DIRECTORY_SEPARATOR ); require_once ( JPATH_BASE .DS.'includes'.DS.'defines.PHP' ); require_once ( JPATH_BASE .DS.'includes'.DS.'framework.PHP' ); echo JPATH_BASE .DS.'includes'.DS.'framework.PHP'; $mainframe =& JFactory::getApplication('sITe'); $mainframe->initialise(); echo $mainframe->getCFg('sitename'); $articleid = JRequest::getInt('Itemid'); $db =& JFactory::getDBO(); $sql = "SELECT fulltext From #__content WHERE id = 260"; //.intval($articleId); $db->setQuery($sql); $fullArticle = $db->loadResult();
文章ID 260可用,但它返回null …
当我跟踪它时,loadResult()中的$cursor是每个null:
public function loadResult() { // Initialise VARiables. $ret = null; // Execute the query and get the result set cursor. if (!($cursor = $this->execute())) { return null; } ...
有人可以帮忙吗?
谢谢
安德烈
define('_JEXEC',1); define('JPATH_BASE',realpath(dirname(__FILE__))); require_once ( JPATH_BASE .'/includes/defines.PHP' ); require_once ( JPATH_BASE .'/includes/framework.PHP' ); require_once ( JPATH_BASE .'/libraries/joomla/factory.PHP' ); $db = JFactory::getDBO(); $query = $db->getQuery(true); $query->select('introtext') ->from('#__content') ->where('id = 260'); $db->setQuery($query); $fullArticle = $db->loadResult(); echo $fullArticle;
希望这可以帮助
以上是脚本宝典为你收集整理的php – 从外部脚本访问Joomla 2.5以获取id的文章全部内容,希望文章能够帮你解决php – 从外部脚本访问Joomla 2.5以获取id的文章所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。