Strange DOMPDF issue with Codeigniter - codeigniter

Just a quickie. I have tested DOMPDF in a Doctrine enabled Codeigniter 1.7.2 installation and everything works fine. However, when the Cart library and URL Helper are autoloaded as well, DOMPDF doesn't work. BUT, if you 'un-autoload' (ie. dont use) any one of Doctrine, the URL Helper or the Cart Library, DOMPDF works.
Is just a bit annoying as I need DOMPDF, Doctrine, the URL helper and the Cart Library all working together.
Could anyone suggest anything please. Any help very gratefully recieved.
Regards,
Matt

mPDF is bloody brilliant and much much better than domPDF, it works in the same way too in that it reads in a html file with your php code placeholders or whatever to add the dynamic content. I have written a small tutorial on how to use it with Codeigniter if you need it.

If you're using DOMPDF 0.5.1 you could be running into conflicts between the __autoload() methods used by the various libraries. The 0.6.0 code base (currently in beta) has been updated to use spl_autoload_register() which helps to prevent auto-loading conflicts between different libraries.

Related

Load css/js files in Laravel 4 with Composer?

I'm working on creating a new project in Laravel 4. I have a tiny bit of experience in Laravel 3, in which I got used to the assets system. I'm now having a lot of trouble figuring out how to load CSS and JS files in the new system.
I believe I should be using Composer PHP, but I'm not sure how. Where do I put the actual .css and .js files? And then how do I load them with Composer to be utilized in the Laravel project?
I know there are outside plugins like Best Asset, etc. that are written to replicate the Assets system of Laravel 3, but I was hoping to understand the new system and not have to use an outside plugin.
Any help? Thanks.
You don't need Composer for your css/js assets. You can use assets pretty much the same as with Laravel 3
You can just place them in your public folder and reference them in your views. You can use plain html, or use the HtmlBuilder: HTML::style('style.css') and HTML::script('script.js')
You must take care of case sensitive.
This class must write with uppercase.
HTML::style('style.css');
HTML::script('script.js');
Laravel stylesheets and javascript don't load for non-base routes

Does CodeIgniter have plugins / extensions / modules?

I am looking at few PHP frameworks and noticed that they all offer re-usable, community-contributed code in various forms:
-Symfony 2 (bundles): http://knpbundles.com/
-Zend Framework 2 (modules): http://modules.zendframework.com/
-CakePHP (plugins): http://plugins.cakephp.org/
-Yii Framework (extensions): http://www.yiiframework.com/extensions/
but I can't find anything for Code Igniter (I saw in this SO post that Code Igniter used to have plugins that were replaced by helpers, but when I google for "Code Igniter helpers" or "Code Igniter plugins" I can't find any repositories).
What is the name for Code Igniter community-contributed and reusable libraries? Can you share a link to their main repository?
You can have a look at sparks and HMVC.
You didn't find this? https://github.com/EllisLab/CodeIgniter/wiki/_pages
Also checkout their forums too.
The previous name plugin within codeigniter didn't really mean the same thing as plugins for Cake or Bundles for Symfony
check this one awesome codeigniter there is a list of different resources for CodeIgniter

Can we install Codeigniter in Magento?

I tried a lot with installing codeigniter in Magento, and I am doubtful now whether it is possible or not. In a critical situation. Is it possible to install codeigniter in Magento ? And can we access codeigniter files through magento? Any links or tutorials for supporting ?
Since both the framework are in PHP itself, the answer is yes. You can install codeigniter by creating a folder with CI files on it. It works. You can share session variables to control the session in between two systems.
But the question is why exactly do you want to do like so ? If you are trying to access codeigniter libraries for your magento app, then answer is no.
But, if these magento and codeigniter works independently on their own, then its fine.

Magento : CMS upload image fail silently

I am trying to figure out why the tinyMCE WYSIWYG editor in the CMS module of Magento will not upload images. I can create/delete folders but any file will simply not get uploaded, and there seems to be no message as to why the file is not successfully written on the server.
Anyone may have an idea why?
** Update **
I'm using Magento 1.6.2. I have tried to track down the problem and it seems that the controller never gets executed. I have added a line to log the arguments in the uploadAction() action (in Mage_Adminhtml_Cms_Wysiwyg_ImagesController) and nothing gets logged.
This is project inherited from someone else, and was modified to some extend, but nothing seems to point out that this part of Magento would have been touched in anyway by the modifications.
** EDIT**
The project associated with this question has been dropped and I no longer can provide an answer to this question. If anyone can confirm a working answer (as this problem was apparantly common with Magento), I will gladly mark that answer as "accepted".
Otherwise, I will flag this question for removal for the aformentioned reasons.
Thank you.
Other than solutions provided here, it may occur when you use a CDN (or a different domain) for your javascript and media files in admin panel. If you use CDN, use it for your website(s) scope and use your own domain for default scope. It will make your website(s) media and javascript files to be loaded from CDN, and backend's media and javascript files to be loaded from your own domain. This will solve your problem.
There are some known issues with flash image uploader on Magento. Unfortunately when it falls, it falls silently. Here are some cases when smth can break it:
if you try to use it with secured connection using open ssl certificate
if you're using it on server with apache authentication
on some Magento versions with prototype 1.7
I think the latter is your best bet. Maybe you should try to apply the patch from here: http://www.magentocommerce.com/boards/viewthread/4348/P45/#t327010
In my case it was a cross domain problem, and one quite hard to find if you ask me...
What was puzzling me was that the uploader for product images was working like a charm but the one in the CMS section was failing completely silently. We are serving the skin folder from an Amazon S3 bucket, and the flash uploader lives under that folder.
Interestingly enough, our version of Magento (1.7.0.2) is using two different methods to calculate the path to the SWF file, depending whether you are under CMS or Product update.
The CMS file (app/design/adminhtml/default/default/template/cms/browser/content/uploader.phtml) is using the following method to embed the Flash Uploader:
<?php echo $this->getSkinUrl('media/uploader.swf') ?>
While the Product image uploader is using:
<?php echo $this->getUploaderUrl('media/uploader.swf') ?>
In our case, the first one resolves to the AWS S3 url, obviously in a separate domain, while the second one will still reference the local domain's url.
So yeah, the quick, dirty fix would be to replace getSkinUrl for getUploaderUrl in app/design/adminhtml/default/default/template/cms/browser/content/uploader.phtml. Alternatively you can extend the core to load a different template in which you would have replaced that method.
I hope this helps somebody... I wish I had found something like this five days ago when I first stumbled upon the issue :-)
Are you using flash uploader with https? If so, is your secure address in differente domain (usually used in shareds ssl)?
I got some trouble with this. I solved by installing a flash uploader disabler plugin.
You can download the plugin with this downloader key:
http://connect20.magentocommerce.com/community/Dull_Uploader
I hope it helps.

Loading all codeigniter controller at the beginning

I've a little problem.
In a controller i will load a function wich is in otherController.
I just use
$pCtrl = new otherController;
for loading the class in that otherController.
The problem is that at that moment the otherController has not already been loaded. So the class is not available.
Can i find a way to tell codeigniter to load all controllers (folder controller) before doing other thing ?
Thanks for help.
This is bad practice. You should be using a CodeIgniter Library to do this instead.
Though, if you're already doing bad things, you could just open the /controllers directory in your config/autoload.php and configure codeigniter to autoload all available controllers. Not sure if this will work well (and efficiently) in practice, so try using libraries.
Its better to create a helper function or a library ..
oh btw , you can use HMVC also .

Resources