簡體   English   中英

從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,則可以在文章中鍵入以下內容:

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

然后,該腳本的輸出將包含在文章的文本中。 同一篇文章中可以有多個ssi命令。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM