On a standalone php script, all I have to do to include phpdocx is
require_once '../phpdocx_pro/classes/CreateDocx.inc';
How do I include phpdocx in Yii? I've my files in components/thirdparty/phpdocx
On a standalone php script, all I have to do to include phpdocx is
require_once '../phpdocx_pro/classes/CreateDocx.inc';
How do I include phpdocx in Yii? I've my files in components/thirdparty/phpdocx
There may be conflict with the autoloaders when you want to ingterate PHPDocX within a PHP framework.
We have explicitly worked it out with other frameworks like Simfony but not yet with Yii.
Anyhow we do not expect it to be an unsurmontable problem :-)
Let us have a look at it and we will get back toy you...
That would be very helpful. I'm not able to do much (for example, MergeDocx is also not working - because it can't find Yii's CException class). Thank You.
I hope you have found the solution.
In the start we also faced similar problem but this fixed teh issue.
in config/main.php in 'import'
'application.modules.phpdocx.classes.*',
'application.modules.phpdocx.lib.*',
'application.modules.phpdocx.lib.dompdfParser.*',
'application.modules.phpdocx.lib.fpdf-tpl.*',
'application.modules.phpdocx.lib.fpdi.*',
'application.modules.phpdocx.lib.log4php.*',
'application.modules.phpdocx.lib.log4php.appenders.*',
'application.modules.phpdocx.lib.log4php.configurators.*',
'application.modules.phpdocx.lib.log4php.filters.*',
'application.modules.phpdocx.lib.log4php.helpers.*',
'application.modules.phpdocx.lib.log4php.layouts.*',
'application.modules.phpdocx.lib.log4php.pattern.*',
'application.modules.phpdocx.lib.log4php.renderers.*',
and use following code where you create new CreateDocx or other PhpDocx object
require_once '/path-to-phpdocx/classes/AutoLoader.inc';
spl_autoload_unregister(array('YiiBase','autoload'));
AutoLoader::load();
spl_autoload_register(array('YiiBase','autoload'));
Or
require_once '/path-to-phpdocx/classes/AutoLoader.inc';
Yii::registerAutoloader(array("AutoLoader", "load"));
Hello,
There's this post:
www.phpdocx.com/blog-news/using-phpdocx-yii
About how to integrate PHPDocX with Yii.
Regards.
Thanks for reply.
At first we used the approach mentioned in your post but it failed. Then we added all the subpaths in yii import config variable and it worked and never tried again the other way.
I'll try the way you mentioned also. It will reduce 13 line to just 1 in YII import.
I see you are not using phpdocx autoloader. I'll reply back after using mix of your and ours config options to see if it works or not.
Thanks