This may appear a little stupid, but i am a new comer to Joomla!
And i'm editing a present component that we want sooner or later to call a little php file that results data. Now for the reason that file i wish to use joomla classes and processes for that database like setQuery and etc.
and that i would like it to browse the joomla prefix ( #__ ). and also the file is produced by me, and so i wondered what i have to include and just how.
Can anybody let me know how to achieve that?
Thanks ahead of time, Eric
It might be do not to incorporate "exterior" php files, I am talking about files from the Joomla structure. But when you'll still wish to accomplish it, you can easily bring that php file everywhere you really need it, and you'll have all Joomla classes and processes available as lengthy while you bring that file from another Joomla tile ( maybe your component access point, a controller, one, view, etc.. ). Besides, in case your file results data, where to incorporate it might be from the inside a template inside your component. If you are using it at any other vacation spot, you need to get the output for your file ( for instance, with doctor_start(), doctor_get_contents() techniques ), and save these to some type of variable to output it from the template. I suppose you most likely already realize how to incorporate that file, but when for instance your file is in the folder "mylibs" within the joomla root, you need to include it such as this:
include JPATH_ROOT . DS . 'mylibs' . DS . 'myfile.php';
Why 's the reason you have to bring that file and you cannot render it as being a template?
I really hope it assisted.
The easiest way is by using extra time like Sourcer or Jumi
Great for getting began before you decide to write 'real' Joomla installable components, modules, plug ins etc...
I believe the easiest way could be an output override. Take a look at the documentation. By doing this it's not necessary to edit a core joomla extension (obviously, since I look just a little closer you do not say your editing a core extension). Anyway, output overrides are pretty awesome, the utilization the functionality of the extension but you're able to perform the final modification.
Inside your current template folder produce a folder known as 'html', then have a look in the link (or any other template, like beez) to look for the structure from the folder the specific extension you are overriding. You'll be able to call the script from inside that override with the joomla functionality, and without hacking the core.
Well alghimo answer lead me into penning this :
define( '_JEXEC', 1 ); define('JPATH_BASE', dirname(__FILE__)); define( 'DS', DIRECTORY_SEPARATOR ); require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' ); require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' ); /* Create the Application */ $mainframe =& JFactory::getApplication('site');
But as mentoined. not suggested on doing that.