简体   繁体   中英

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. 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. This is the index.php in the html root, not the index.php in one of the template folders.

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. 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:

<!--#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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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