API

Phoca PDF - creating PDF documents in Joomla! CMS
stackideas
Phoca Newbie
Phoca Newbie
Posts: 1
Joined: 16 Aug 2011, 19:16

API

Post by stackideas »

Hey guys,

Great component you have here and we are in the midst of trying to get an integration going with our component, EasyBlog. I've been experiencing quite a bit of issues when trying to create a plugin for PhocaPDF (Particularly the plugin rendering part).

PhocaPDF on both Joomla 1.5, Joomla 1.6 is lacking the following codes in the file /administrator/components/com_phocapdf/helpers/phocapdfrender.php at line 137 and 138

Code: Select all

$dispatcher	= JDispatcher::getInstance();
JPluginHelper::importPlugin( 'phocapdf' );
If the above isn't imported or loaded, it'll trigger an error.

Second, I am not too sure if this is the correct way of doing things but looking at the codes, there's actually no way to render the parameters through the back end of PhocaPDF. In the PhocaPDF component for Joomla 1.6, the file /administrator/components/com_phocapdf/views/phocapdfplugin/tmpl/edit.php is pointing to the following location,

Code: Select all

if(JFile::exists(JPATH_COMPONENT_ADMINISTRATOR.DS.'views'.DS.'phocapdfplugins'.DS.'tmpl'.DS.'default_'.$this->item->element.'.php')) {
	echo $this->loadTemplate($this->item->element);
} else {
	echo JText::_('COM_PHOCAPDF_PLUGIN_NOT_EXIST');
}	
Notice the first line where it is trying to look for '/views/phocapdfplugins/tmpl/default_xxx.php'. At the second line, it is trying to run loadTemplate which loads the file /views/phocapdfplugin/tmpl/default_xxx.php . This would basically mean,

1. You need to have a dummy file available at /views/phocapdfplugins/tmpl/
And
2. You need to also have a configuration file available at /views/phocapdfplugin/tmpl/

On a side note, as a plugin developer I do think that the back end option should be made easily where the component should try to render the above file from the plugins folder /plugins/phocapdf/element/element_params.php or something similar. That would really make installation work easily :)
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: API

Post by Jan »

Hi,

1) $dispatcher - I will take a look at it and will do some more tests

2) in fact it is really complicated system to explain it in details - in Joomla! you have mostly two kinds of view - one for detail of an item, second for item lists - Phoca PDF Plugin view combines both of them - because you are editing the plugin but you can see the whole list of Phoca PDF Plugins - because of different loading of models and controllers and classes which then are extended by the component, the view is written this way. And the code is only checking of the plugin - it can happen, that there will be no plugin loaded so the view is empty - in such case the if clause condition solves this and no error is displayed. Just an error handling code.

Jan
If you find Phoca extensions useful, please support the project
Post Reply