Zend-framework Loading mpdf in a Project - zend-framework

I have a project in zend 1.12 and I tried to use composer and then use mpdf, but it did not work, as it always goes to controller, and I am new to Zend-framework.
[09-Feb-2017 00:32:28 Europe/Kiev] PHP Warning: require_once(C:\wamp\www\Avala\application\controllers/vendor/autoload.php): failed to open stream: No such file or directory in C:\wamp\www\Avala\application\controllers\PdfCreatorController.php on line 30

I got it. Just copy mpdf folder inside library/ of zend 1 and then call it as
//loading mpdf class from library
requre_once 'mpdf/mpdf.php';
//call instance of mpdf
$pdf = new mPDF('utf-8', 'A4-L'); // New PDF object with encoding & page size
then its work. do not need any other settings

Related

DomPDF not working in Zend Framework 1.12.0 An input file is required (i.e. input_file _GET variable)

DomPDF throws the following error, using Zend Framework 1.12.0.
Error
An input file is required (i.e. input_file _GET variable).
However, it works fine using Zend 1.7.0.
Here is the way I've included it in the controller
require_once("dompdf_config.inc.php");
spl_autoload_register('DOMPDF_autoload');
And this is how I instantiate Zend Loader Autoloader in my Bootstrap file
$loader = Zend_Loader_Autoloader::getInstance();
$loader->setFallbackAutoloader(true);
I believe it may be due to autoloading DOMPDF. Any suggestions?

how to use phpexcel in zend framework

I need to import data from excel,And the I decided to use PHPExcel,But when I require it in my web , a few warnings occured :
Warning:
include_once(PHPExcel\Shared\ZipStreamWrapper.php) [<a href='function.include-once'>function.include-once</a>]:
failed to open stream: No such file or directory in D:\www\LearningCenter\library\Zend\Loader.php on line 146
here is my code.:
public function getUserFromExcel($path){
echo $path;
require_once 'Excel/PHPExcel.php';
echo $path;
}
and my webapp structre is :
library
Zend
Excel
others-thirdpart-library
it seems that there is something wrong with the autoloader.
I read a few articles But did not find a solution.
My final aim is to read date from an excel file:
can some one give me some sugestion on ether how to use phpexcel in zend or how to import data from excel useing zend itself.
thanks
copy the PHPExcel library into your /library directory, the structure should be as follows
/library
/PHPExcel
/PHPExcel.php
and then add this in your application.ini
autoloaderNamespaces[] = "PHPExcel_"
autoloaderNamespaces[] = "PHPExcel"
and it should work.
Add your lib to library folder. (libarary/PHPExcel)
Add new autoloaderNamespaces.phpexcel = "PHPExcel_"
You can use library method using PHPExcel_IOFactory::createReader($inputFileType);
The problem is related to autoload PHPExcel classes.
I suggest to avoid to have problems with autoload PHPExcel classes to use the zf2 module MvlabsPHPExcel that will give you an easy integration of [PHPOffice/PHPExcel][2] library into zend framework 2.

Not able to register Plugin in Zend Framework application.ini

my plugins directory sits in
application
/plugins
Dbcount.php
ModuleLayout.php
i am unable to register the plugin with frontController. here is my application.ini code.
#Plugin path and namespace
pluginPaths.Plugins = APPLICATION_PATH "/plugins"
autoloaderNamespaces[] = "Plugin_"
#register plugin
resources.frontController.plugins[] = "Plugin_DbCount"
it gives me following error.
Warning: include_once(Plugin/DbCount.php) [function.include-once]: failed to open stream: No such file or directory in /Users/azhararmar/htdocs/joofris/v1/library/Zend/Loader.php on line 146
Warning: include_once() [function.include]: Failed opening 'Plugin/DbCount.php' for inclusion (include_path='/Users/azhararmar/htdocs/joofris/v1/application/../library:/Users/azhararmar/htdocs/joofris/v1/library:.:/Applications/MAMP/bin/php5.2/lib/php') in /Users/azhararmar/htdocs/joofris/v1/library/Zend/Loader.php on line 146
Fatal error: Class 'Plugin_DbCount' not found in /Users/azhararmar/htdocs/joofris/v1/library/Zend/Application/Resource/Frontcontroller.php on line 117
what is wrong?
If you are using the default appnamespace Application, then the plugin stored in application/plugins/DbCount.php should be named Application_Plugin_DbCount. Use the full classname when you register:
resources.frontController.plugins[] = "Application_Plugin_DbCount"
To use the namespace like that your Plugin classes need to be under Library or you need to map them else where. Looks like you have the frontcontroller plugin set up right but incorrect autoload definitions.
Easiest thing to do here is to name your plugins YourAppNamespace_Plugin_YourPluginName.
They are two types of plugin in ZF . You are mixing some part of each .
To make your code work do
1) put application dir in include_path
2) change directory name plugins to 'Plugin'

How to add my new plugin to smarty?

I want to add a SmartyFilter class to smarty, but where to put the file so smarty can find it automatically?
Smarty comes with a plugins subdirectory. Throw your script in there and smarty will find your plugin in there.
You can extend that path by adding other directories to $smarty->plugins_dir[]
$smarty->plugins_dir[] = 'includes/my_smarty_plugins';
If your plugins are dependant on each other you may want to require a plugin yourself by doing:
require_once $smarty->_get_plugin_filepath('function', 'html_options');
This would load a plugin in plugin_dir with the name function.html_options.php.
copy and paste theme into "plugins" sub directory in main smarty folder, the file name must be leading with function.filename.php
In recent versions of Smarty, you have a method to add a plugin folder:
// Add a folder of plugins
$smarty->addPluginsDir('./plugins_1/');
// Check what plugins folders are registered
var_dump($smarty->getPluginsDir());
/* DUMP:
array(2) {
[0]=>string() "./plugins/"
[1]=> string() "./plugins_1/"
}
*/
For more information, you can read the addPluginsDir() documentation.

Symfony 1.4x and sfTCPDFPlugin

I have installed sfTCPDFPlugin in my project, but when I try to test if the installation is alright (with the source found on the official site) I get the error:
Fatal error: Class 'TCPDF' not found in C:\wamp\www\mairie\plugins\sfTCPDFPlugin\lib\sfTCPDF.class.php on line 12
How can I fix it?
Read the readme tab here : http://www.symfony-project.org/plugins/sfTCPDFPlugin
It says you have to download the tcpdf library, not only the sfTCPDFPlugin.
i faced with same problem, and i did the following task it will also help you.
first of all run: symfony plugin:uninstall sfTCPDFPlugin then remove the sfTCPDFPlugin directory form your plugin folder.
mow do the following setps:
1. cd your project path/symfony
2. symfony plugin:install sfTCPDFPlugin
3. download the tcpdf library unzip it and past into your sfTCPDFPlugin/lib now your directory looks like your project path/symfony/plugins/sfTCPDFPlugin/lib/tcpdf
now change your ProjectConfiguration.class.php to add $this->enablePlugins( array('sfTCPDFPlugin') ); now run the symfony plugin:publish-asstes and finally clear the cache symfony cc.