There's this list, the irc channel and sometimes, stackoverflow, but your mileage may vary on how much effort you put into solving the problem yourself vs how much help you may receive.
On Wednesday, 18 December 2013 02:50:59 UTC+10, Silver Troy wrote:
-- For example, you may experience a bit of radio silence when asking questions that are covered in the documentation at http://book.cakephp.org/2.0/en/
For example, uploading a file is partially covered by http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#options-for-create, by specifying that your form is going to be for a file, and then adding an input field that has the type of file. When the form is submitted, the $this->request->data will have a file descriptor, as described here: http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#FormHelper::file
Saving data to multiple models is covered by Model::saveAssociated : http://book.cakephp.org/2.0/en/models/saving-your-data.html#model-saveassociated-array-data-null-array-options-array. Though you may need to add some special processing in the controller to read the file upload descriptor into a database field on the model, in the appropriate format (some databases require special encoding before storing binary files).
With regards to the year issue, take note of the sample code at http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#FormHelper::year. Notice the input name is data[User][purchased][year]. This means that the FormHelper displays the year component of a whole date field, so when you inspect $this->request->data('User.purchased'), it is likely to be an array. Personally, I'm not much of a fan of the way the FormHelper does date processing, so you may be better off just doing a FormHelper::select, and specify the year entries you are interested in.
I thought the document is pretty nice for showing how to implement plugins (http://book.cakephp.org/2.0/en/plugins.html), helpers (http://book.cakephp.org/2.0/en/views/helpers.html#creating-helpers) and components (http://book.cakephp.org/2.0/en/controllers/components.html#creating-a-component). CakePHP also has plenty of implemented helpers and components in it's core to look at for initial guidelines and best practice. For plugins, you may have to dig a little deeper, but they're really just mini apps wrapped up for use with other applications. You just need to stick to the naming convention. Personally, I'm looking forward to CakePHP 3.0 for plugins, when namespaces will be implemented properly, and we won't have to be as concerned with namespace / class name clashes.
I thought the document is pretty nice for showing how to implement plugins (http://book.cakephp.org/2.0/en/plugins.html), helpers (http://book.cakephp.org/2.0/en/views/helpers.html#creating-helpers) and components (http://book.cakephp.org/2.0/en/controllers/components.html#creating-a-component). CakePHP also has plenty of implemented helpers and components in it's core to look at for initial guidelines and best practice. For plugins, you may have to dig a little deeper, but they're really just mini apps wrapped up for use with other applications. You just need to stick to the naming convention. Personally, I'm looking forward to CakePHP 3.0 for plugins, when namespaces will be implemented properly, and we won't have to be as concerned with namespace / class name clashes.
The last one sounds like an actual application problem, rather an issue with CakePHP. With that one line description, there are a lot of parts to deal with. Start with the model. Maybe add a Tree Behaviour to help represent the tree, and find neighbours and children. Set up a controller, and find the entries, using the model. Perform a set in the controller, to set the data for use in a view. Write the view to processing and display the data. Perhaps you have a Javascript component in mind that will display the data in the tree. Perhaps it takes json for the structure. Perhaps it can load via Ajax, so then you would read up on the JsonView class, and the $this->set('_serialize', ...) method of serializing data in a view variable, plus looking at the RequestHandlerComponent for accepting ajax and json requests.
The other hidden gem with CakePHP is the test suite. The test suite tests all the core functionality in CakePHP, so you can see how the FormHelper::select should be used to populate a dropdown list.
I'd also recommend following the Blog Tutorial. Then expand on it a bit to add an EntryType to the Post model, and see what scaffolding adds to the add and edit controller actions and views. This will show you how to populate a drop down (hint: in the controller: $entityTypes = $this->EntityType->find('list'); $this->set(compact('entityTypes')); and in the form, $this->Form->input('entityType');)
It's been a very long time since I looked at the Zend Framework, so I'd recommend you take a look, and see if you can get the job done there, and see if there the same level of help there, as you expect to find here. Last time I looked at it, the class names were more noise than useful, and there was a lot of cruft that made the framework seem bloated. Maybe it has slimmed down since then, and the learning curve for doing things the Zend way isn't as steep as it used to be. Then once you've solve the problem in Zend, come back and take another look at CakePHP, and solve the same problem, purely as a self education exercise. I'm thinking you might be pleasantly surprised.
I subscribe to the posts on this list, and get a daily digest. Depending on the question, and how much effort has been put in, I'll help out when I can, as a civic duty, to give a little back to the framework that has made development in PHP so much easier over the years.
Definitely post questions here, if you're looking for help (try to do one question per post, to keep the conversation thread clean and understandable). Chances are, someone will be able to guide you to the answer, and who knows, before too long, you'll be able to guide others to their answers as well.
Regards
Reuben Helms
On Wednesday, 18 December 2013 02:50:59 UTC+10, Silver Troy wrote:
Hello Cakephp users,
I am just looking for someone that is familiar with Cakephp and can help me figure out simple processes in CakePhp.
I am looking for help with things like:
~ uploading a image
~ saving a form to say products table, but saving images uploaded to a product_images table.
~ how to save $this->Form->year() .. breaks my code says its an Array.
~ implementing plugins, helpers, components, etc
~ building a category tree with products showing in each level of the category tree.
I probably have a number of other questions as well. I have hunted google for tutorials, video tutorials, i have read
the cookbook and tried the cake irc channel (with some success).
I just realize that I am wasting hours of my time looking for solutions that could be answered in a simple
email or chat.
I find that there is very little out there for Cakephp 2.0 tutorials and they are looking to bring out cakephp 3.
Even the Cakephp Youtube channel doesn't have simple tutorials on say creating a form and dealing with filling dropdown lists.
They go into advance topics, where most new cakephp users just want to get past the basic functionality learning curve.
Yes I have done the blogging tutorial and found Andrew Perkins tutorials on youtube to be excellent. I actually wish he had more.
So if you or someone you know can help me, that would be greatly appreciated.
I am actually getting to the point of looking at Zend Framework .. because I really don't see a vibrant CakePHP community.
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment