簡體   English   中英

創建文章作為菜單項

[英]Create article as menu item

我對使用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);

我希望能夠將文章創建為菜單項,但我什至不知道從哪里開始。 任何幫助表示贊賞。

問候

吉姆

我認為您正在使它變得比所需的更為復雜。 實際上,這很簡單。 在管理員面板中,轉到菜單。

菜單>主菜單(或所需菜單)>單擊“添加新”>菜單項類型(單擊)>單擊“文章”以展開該部分>“單個文章”

當您執行此操作時,將打開一個選項,您可以在其中選擇要顯示在該菜單項上的文章。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM