[英]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,则可以在文章中键入以下内容:
<!-#include virtual =“ dynamic_content.php”->
然后,该脚本的输出将包含在文章的文本中。 同一篇文章中可以有多个ssi命令。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.