将php页面中的mysql值传递给joomla文章,并在joomla的文章中显示相关数据


pass mysql value from php page to a joomla article and display relevant data inside of a joomla article

我们正在开发一个应用程序。网站由joomla开发。Admin面板是使用纯php.on索引页(joomla)开发的,我们从后端显示了一些细节。我的问题是,当我们点击页面上的一条记录时,我们能在文章中显示相关数据吗?

希望我把问题问清楚了。请与我们分享您的想法。

提前感谢

是的,如果我正确理解你的问题,你可以这么做。

打开Joomla的主index.php。这是html根目录中的index.php,而不是某个模板文件夹中的index.php。

在文件底部附近,或者在最后一行,你会看到这样的东西:

// Return the response.
echo $app

将此行替换为以下内容:

// Return the response.
// parse $app for server side includes statements and execute them
// note: this will only work for executable code, it will not import text or html files
// we would need to check to see if the file were executable, then read it rather than execute it if it were not
$output = $app;
while(ereg('(<!--#include virtual="([^&]+)" -->)',$output,$groups)){  // extract the ssi command and the command
$i = 0;
    while(!$inline){                                        // sometimes exec() fails for want of memory so we try a few times
        exec($groups[2],$array);                            // get the output from the command
        foreach ($array as $element)                        // concatenate the lines of output into a single string
            $inline = $inline . $element . "'n";            // appending a new line makes the html source more readable
        $i++;
        if($inline | $i > 5)
            break;
        sleep(1);
    }
    $output = ereg_replace($groups[1],$inline,$output); // replace the ssi command with the output
}
echo $output;

这将允许您在文章中放置一个标准的服务器端include语句。前面的例子,如果你想在与index.php相同的目录中执行一个php文件,并且该文件名为dynamic_content.php,你可以在文章中键入以下内容:

&lt--#include virtual="dynamic_content.php"-->

然后,该脚本的输出将包含在文章的文本中。在同一篇文章中可以有多个ssi命令。