简体   繁体   English

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

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

we are developing an application.website is being developed by joomla.Admin panel is being developed using a pure php.on index page(joomla), we are displaying some details from the backend. 我们正在开发一个应用程序。joomla正在开发网站。Admin面板正在使用纯php.on索引页(joomla)开发,我们在后台显示一些详细信息。 my question is this, when we click on one of the records on that page can we display the relevant data inside of a article? 我的问题是,当我们单击该页面上的记录之一时,是否可以在文章内显示相关数据?

Hope i asked the question clearly. 希望我清楚地问了这个问题。 please share your thoughts with us. 请与我们分享您的想法。

thanks in advance 提前致谢

Yes, you can do this, if I understand your question correctly. 是的,如果我正确理解您的问题,则可以执行此操作。

Open up Joomla's main index.php. 打开Joomla的主要index.php。 This is the index.php in the html root, not the index.php in one of the template folders. 这是html根目录中的index.php,而不是模板文件夹之一中的index.php。

Near the bottom of the file, or maybe the very last line you will see something like this: 在文件底部或最后一行附近,您将看到类似以下内容:

// Return the response.
echo $app

Replace this line with the following: 将此行替换为以下内容:

// 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;

This will allow you to place a standard server side includes statement in your article. 这将允许您在文章中放置标准服务器端include语句。 Fore example if you want to execute a php file in the same directory as your index.php and the file is called dynamic_content.php you would type this in your article: 例如,如果要在与index.php相同的目录中执行php文件,并且该文件名为dynamic_content.php,则可以在文章中键入以下内容:

<!--#include virtual="dynamic_content.php"--> <!-#include virtual =“ dynamic_content.php”->

The output of that script will then be included in the text of the article. 然后,该脚本的输出将包含在文章的文本中。 You can have multiple ssi commands in the same article. 同一篇文章中可以有多个ssi命令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM