Integration of PHP pages with Joomla

cscg1976
cscg1976 used Ask the Experts™
on
I am trying to decide on how easy it is to include complex PHP pages into a Joomla site. And what are the steps needed to integrate these PHP pages into the site? Does it worth it to go with this? Are there any joomla extensions helping on this? How can we integrate these PHP files with the template and Menu and go from one page to the other?

I will appreciate any assistance.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
It depends on the PHP pages. There is a module that you can add custom PHP code in it and publish in any module position:
http://extensions.joomla.org/extensions/edition/custom-code-in-modules/1758/details

however if you need something more complex, you can always load your PHP pages in iframes.

If the PHP pages you want to include in Joomla contain mysql queries, you have to use your joomla mysql login information.

you can do this by using the following code:
$path = getcwd();
$p = str_replace('path from where this file is located','',$path); // assumed that this file is located in a joomla subfolder
include_once $p."/configuration.php";
 
  $config =& new JConfig;
  
  $host = $config->host;
  $user = $config->user;
  $password = $config->password;
  $dblink = $config->db;
  $dbpre = $config->dbprefix;
  
  $link = mysql_connect($host, $user, $password);
  mysql_select_db($dblink, $link);
  mysql_query("SET NAMES 'utf8'"); // if your need your database queries to support UTF-8 encoding
 
		// load the database queries
  $dbQuery = "SELECT * FROM ".$dbpre."joomlatable"; // where joomlatable the name of any joomla database table you need queried
  $result = mysql_query($dbQuery, $link);
  $num_rows = mysql_num_rows($result);
// etc...

Open in new window

Another Joomla solution I have used to include PHP snippets is a joomla plugin called Jumi.

http://extensions.joomla.org/extensions/edition/custom-code-in-content/1023/details

Basically you reference php pages on the server with placeholders in your joomla pages.

Not sure how good this would be for extensive php inclusions, but I have found Jumi very handy for adding php code to "articles" in some of my sites.

...Rowby

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial