Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 从Joomla中my模块的文章中获取自定义高级参数_Php_Joomla - Fatal编程技术网

Php 从Joomla中my模块的文章中获取自定义高级参数

Php 从Joomla中my模块的文章中获取自定义高级参数,php,joomla,Php,Joomla,我的网站主页上有一个小新闻模块。它显示了Joomla管理员添加的新闻文章 它在模块部分显示文章标题 但我不想在主页的新闻模块中显示文章标题。我需要在新闻模块中显示一些其他文本,而不是新闻标题 为此,我在文章管理器中添加了一个名为“NewsTitle”的新自定义参数 这个新的自定义参数将被保存并与其他文章内容一起正确更新 但在新闻模块中检索此自定义参数的值时遇到问题 下面是用于获取模块中文章标题的代码 // getting content $this->content

我的网站主页上有一个小新闻模块。它显示了Joomla管理员添加的新闻文章

它在模块部分显示文章标题

但我不想在主页的新闻模块中显示文章标题。我需要在新闻模块中显示一些其他文本,而不是新闻标题

为此,我在文章管理器中添加了一个名为“NewsTitle”的新自定义参数

这个新的自定义参数将被保存并与其他文章内容一起正确更新

但在新闻模块中检索此自定义参数的值时遇到问题

下面是用于获取模块中文章标题的代码

        // getting content
    $this->content = $newsClass->getNewsStandardMode($categories, $sql_where, $this->config, $this->config['news_amount']);
    //
    $this->SIDTab = $this->content['SID'];
    $this->titleTab = $this->content['title']; 
    $this->textTab = $this->content['text']; 
    $this->idTab = $this->content['ID'];
    $this->cidTab = $this->content['CID'];

下面是我用来显示文章标题的代码

function render(&$params)
{
    $content = array();
    //
    for($i = 0; $i < count($this->idTab); $i++)
    {
        $content[$i] = '';
        //
        if($this->config['links'] == 1)
        {
            $url = $this->idTab[$i].'&Itemid='.$this->config['item_id'];

            if ($this->config['url'] != ""){
                $content[$i] .= '<a href="'.$this->config['url'] .'">';
            } else {
                $content[$i] .= '<a href="'.JRoute::_(ContentHelperRoute::getArticleRoute($url, $this->cidTab[$i], $this->SIDTab[$i])).'">';

            }

        }
// some more code }
函数呈现(&$params)
{
$content=array();
//
对于($i=0;$iidTab);$i++)
{
$content[$i]='';
//
如果($this->config['links']==1)
{
$url=$this->idTab[$i].&Itemid='.$this->config['item_id'];
如果($this->config['url']!=“”){
$content[$i]。='';
}否则{
$content[$i]。='';
}
}
//还有一些代码}
请帮忙


谢谢。

当模块获取参数时,是从文章中提取模块参数,而不是文章中的参数。文章的参数存储在jos_内容表的属性字段中。您需要从那里获取文本


有一种更简单的方法可以做到这一点,而无需对核心进行黑客攻击。我注意到,您的文章中没有任何介绍文本。将要使用的文本放在文章内容的开头,并在后面插入一个“阅读更多”分隔符会更容易。现在,您想要的文本将由Joomla作为介绍文本进行处理。您可以将其设置为“显示”ay位于模块中,将隐藏在文章视图中。这可以防止您必须破解core,以便轻松更新,并且应该可以更轻松地显示所需内容。

@markus我无法检索自定义文章参数。我已更新了我的问题。