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
Related
I am using the following code to check the logged in user's group (cakephp 1.3)
Session->read('Auth.User.user_group_id') != User::USERLEVEL_USER) :?>
(this is in .ctp file)
and now am migrating to cakephp 2. and this code is not working.
cant find any results when I googled .
Could anyone shed some light on this
in cakephp 2.x you're sending variables to view, so you don't have access to User class. you should get instance of this class in controller and send it as a variable to view.
please use this plugin to improve your debugging skills:
https://github.com/cakephp/debug_kit
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've developed a bug tracker using CakePHP 2.4.4. I made this as a standalone cakephp app but now I wanna transfer it to a plugin, in order to reuse it in other projects.
As I already read at the docs (http://book.cakephp.org/2.0/en/plugins.html), I have followed the instructions from there and created the correct folder and files structure. This is what i've done so far: https://github.com/lubbleup/BugCake/tree/plugin
But now,when i try to use the plugin in a separate cakephp installation, I cannot understand how to make of the plugin and, for example, use it's controllers and functionality etc.
can anyone help me out here?
ps:this is my first time trying to create a cakephp plugin
Thank you in advance!
You have to load the plugins your parent app in APP/Config/bootstrap.php
CakePlugin::loadAll();
You do not need AppModel or AppController in your plugin. Your plugin has an own AppController/-Model named PluginNameAppController/PluginNameAppModel.
You can call your plugin at http://host/plugin_name/controller/action/[...]. In your case http://host/bug_cake/issues/view/1 for instance.
But you can also use custom routes in your plugin with plenty of options.
Hope that answers your question—if not, comment.
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 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 :)