Joomla2.5のidによる記事を読むのが好きです。私はフレームワークの中にいないので、最初にそれを含める必要があります。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();
記事ID260が利用可能ですが、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;
}
...
誰か助けてもらえますか?
アンドレありがとう