2015-11-17 70 views
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); 

我希望能夠創建文章作爲菜單項,但我甚至不知道哪裏可以開始。任何幫助讚賞。

問候

吉姆

回答

0

我認爲你正在做的有點複雜得多,它需要的。其實這很簡單。在管理員面板中,轉到菜單。

菜單>主菜單(或菜單你想)>點擊「添加新」>菜單項目類型(點擊)>點擊「文章」擴大部分>單篇文章

當你做,你將有一個選項打開,您可以選擇您想要在該菜單項上的文章。