0
我是相當新的使用Joomla(3.3)和我也跟着上的一則訊息說明編程方式使用此代碼來創建一個文章:創建文章的菜單項
<?php
define('_JEXEC', 1);
define('DS', DIRECTORY_SEPARATOR);
if (file_exists(dirname(__FILE__) . '/defines.php')) {
include_once dirname(__FILE__) . '/defines.php';
}
if (!defined('_JDEFINES')) {
define('JPATH_BASE', dirname(__FILE__));
require_once JPATH_BASE.'/includes/defines.php';
}
define('JPATH_COMPONENT_ADMINISTRATOR', JPATH_BASE . DS . 'administrator' . DS . 'components' . DS . 'com_content');
require_once JPATH_BASE.'/includes/framework.php';
require_once JPATH_BASE. "/administrator/components/com_content/models/article.php";
$app = JFactory::getApplication('site', array('session' => false));
$new_article = new ContentModelArticle();
$data = array(
'catid' => '17',
'title' => 'Title',
'introtext' => '<h4><strong>Intro Text Here</strong></h4>',
'fulltext' => '<p>This is the full text paragraph </p>'
'state' => 1,
);
$new_article->save($data);
我希望能夠創建文章作爲菜單項,但我甚至不知道哪裏可以開始。任何幫助讚賞。
問候
吉姆