Thanks for the reply Jeremy,
Yes, you are correct about the "defined('_JEXEC') or die ('No direct access');", it kills any attempt to directly access the php page.
Your suggestion about extracting the data from an rss feed is a good suggestion. But in this case, i am just using the "Latest news" module as an example.
In general i am referring to any module, especially the ones that people put on the right and left hand sides of the pages like the "Who's online" module or the "Login" module. I cannot extract this data from an rss feed.
So what i am really asking is if i take out this statement from a module;
defined('_JEXEC') or die ('No direct access');
How would i write a piece of code that would allow this module to work in external pages on the same domain?
I have been doing something along these lines for a while now, but this method will only allow me to extract data from the MySql database, it WON'T allow me to include many of the files needed for other modules.
This is what i am doing for one particular module i have installed on one website.
External to the joomla framework, i connect to the database;
$username = "XXXXXX";
$password = "XXXXXXX";
$hostname = "XXXXXXX";
//connection to the database
$dbhandle = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
//select a database to work with
$selected = mysql_select_db('mydb_sitename',$dbhandle)
or die("Could not select examples");
Then i select the correct "params" from the correct "module" with the correct module "id";
//execute the SQL query and return records
$query = mysql_query("SELECT params FROM jos_modules WHERE id='74'");
//Some extra settings
require_once ($_SERVER['DOCUMENT_ROOT'] .'/extras/Special-Modified-Helper.php');
$rowdata = mysql_fetch_assoc($query);
After that, i have 3 specially written php functions that extract the information from the Joomla module params as Joomla has a funny way of storing module parameters in the database.
This works fine for this particular module, but it won't work for all the Joomla includes and libraries and other stuff that many Joomla modules need to work.
Compute for science and for a better world!www.unitedboinc.com