I found this great article:
http://bakery.cakephp.org/articles/kalileo/2010/06/08/creating-pdf-files-with-cakephp-and-tcpdf
And it works fine with CakePHP 1.2, but I tried it with CakePHP 2.0 and the same Code results just a page with many strange characters.
Obviously there has something changed in CakePHP 2.0, but what is it?
Latest TCPDF works fine with Cakephp 2.0. The 'problem' you are having is mostly likely the browser displaying the PDF inline as html. It is caused by spurious whitespace at the end of controller/view files that causes the browser to assume text/html mimetype instead of PDF.
There have been a lot of 'breaking changes' from CakePHP versions 1.x to 2.x.
I have only looked at the TCPDF code briefly, but I would recommend you trying to update the code so that it works with 2.0. The main relevant changes are naming conventions and loading of Vendor files.
Follow the migration guide, and if you do manage to get it working, contact the author and share the code! Good luck :)
Related
Im working with cakephp for few months and recently I came across croogo, a cakephp cms system. I've tried it and I should say its an awesome system.
Is it possible to use it as a plugin in my main site. I want to use it just for the admin part and rest of my application unattached to it. Ive tried loading its bootstrap file from my main app and also by linking routes to it. I always get errors.
Can someone have any idea if croogo is meant to be used like a plugin or does it have to be used seperately?
"Beginning version 1.6.x, Croogo has been updated to be installed as a vendor package"
=> So yes, it is possible to use it in your code - just not as plugin, but vendor.
See
https://github.com/croogo/croogo/tree/3.0#installation-using-git
I am using cakephp 2.x to make one site multilingual and I am using the i18n extract and the TranslateBehavior Core Library.
The i18n works fine and the TranslateBehavior Core Library works fine when I try to save data. But when I want to read it I have to say to the controller the specific locale with:
$this->Home->locale = 'spa';
or
$this->Home->locale = 'eng';
Instead the core library makes it automatically by me. I have to specify all the times the locale? Or does exist something that do it automatically?
Thank you very much
There is a detailed article about i18n on Cakephp 1.3, I hope your 2.x will also work on this say theory so you can have a try with that http://codeatomic.com/developing-cakephp-multilingual-website/
I was following pdf blog tutorial, and in the PostsController where $this->Post should be available another method postConditions() is the only choice. According to the PDF Post is accessible due to the naming conventions. But it is not in my case.
I have created:
model Post.php - according to the pdf
Controller PostsController - according to the pdf
I use PhpStorm IDE to help me out with the stuff....
What did i do wrong? Could someone help me out?
I am using Cake 2.3.0 Stable on localhost XAMP
Thanks
I'm assuming you mean autocomplete in your editor is not working?
CakePHP dynamically loads classes as and when they are references, your editor does not, so it is unaware of what Post is as it doesn't know anything about it.
I don't use PhpStorm, but here's someone who's says they've got it working: http://blog.hwarf.com/2011/08/configure-phpstorm-to-auto-complete.html
All,
As I am still using CakePHP 1.3 I am in need of using the acl_extras plugin for this version of Cake. Does anyone know where I can possibly find one? The one on GitHub https://github.com/markstory/acl_extras is for CakePHP 2.0.
Thanks,
On github nothing gets lost. you just need to switch to the 1.3 branch:
https://github.com/markstory/acl_extras/tree/1.3
https://abc.hostingcompany.com/~myusername/img/test.jpg //works, shows the test image
https://abc.hostingcompany.com/~myusername/contact //404 error
http://www.mydomain.com/contact //works as expected, so why dosent #2?
I dont understand how cakePHP 'pages' can be routed to, using SSL.
As I understand it, using relative paths is what you are supposed to do, which I have done. I know there is a component built into cakePHP for security, but for now, just getting the (for example) https version of the contact page link to work is perplexing me.
In my research, I discovered that you can use .htaccess command RewriteBase to convert between the shared version of the URL and the cakePHP version of the url.
I also learnt that relative pathing is important, and that /img/test.jpg is not the same as img/test.jpg (One assumes the root, the other does not).
As long as Im sharing what I found out... (yeah, noob material here... Id like to see any other page on the net with all this in the same spot)
The https version is the same code (pulled from the same folders I mean) as the http code.
Turning on (using) and off https is as simple as a link to https://[yoursite] and http://[yoursite].
And a shoutout to the people at apacheserver.net ripping this off stackoverflow.com. (Its already in the google search results... holy cow)