Re: Looking for Help with Cakephp basics .. aka looking for a mentor

2013-12-21 Thread Reuben Helms
When I get back from my Christmas break, I'll have a look at a bit of code
I usually stick in my AppController or AppModel (it's been that long, I
cant quite remember where it sits), but basically, it uses convention to
recognise a file upload, and will save the file contents to a database
field.

For a Search tool, I'd recommend Lucene for indexing, and do local HTTP
calls to get the search results.  I think Zend may even have a PHP lib to
assist with Lucene, but at some point, you're going to have to get your
hands dirty and actually set it up (it's Java based).  Actually, scratch
that.. use Apache SOLR. It sits on top of Lucene, and provides the HTTP API.

Pagination is pretty simple. The Pagination component assist with defining
the query, and getting the data.  The Pagination Helper assist with display
of numbers and first, last, next, previous options.  I usually do an
element to roll all those things into one call from the view.

Breadcrumbs are easy if a page is only available from one menu option.
 They can get a bit trickier if a page can exist at two menu options, and
you don't know which one ( I give you the mess that is Joomla's ItemID,
used to identify a page displayed on a particular menu).

Anyway, you have a good Christmas, too.


On Sat, Dec 21, 2013 at 2:12 AM, Silver Troy educatedr...@gmail.com wrote:

 Hello Reuben,
   I want to thank you for that well thought reply, the answers and
 pointers you have given me.  I really do try and find the answers through
 google, the cook book, youtube and irc.  I just know that sometimes people
 can answer your question in a couple minutes that will save you hours of
 wasting your time.
 I have read through the cook book a few times already and though it does
 give some basic examples it lacks answering common problems.

 I have done the blog tutorial, expanded it with Andrew Perkins youtube
 tutorials to add in authorization.  I have built a basic administration
 section and a user account section with routing (that took way too much
 time messing around).  I have been able to create form dropdowns that get
 populated from other models, and I recognize the
 data['User']['purchased']['year']  from the examples.  I have built a
 number of different sections like products, manufacturers, dealers, deals,
 users using the basic scaffolding.

 I do need to get into the Category Tree Structure, which I have looked
 into a number of examples, going to need to implement Pagination,
 Breadcrumbs and a proper Search tool (that works with multi-word
 searches).  Not to mention uploading multiple images for a product with a
 main (or default) image set.  I have been looking into using a plugin to do
 the image upload but that has been challenging to get one installed and
 working properly.

 The next time I post .. I will keep it to one problem and try and layout
 what I have done.

 Have a good Christmas.


  --
 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 a topic in the
 Google Groups CakePHP group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/cake-php/OsnN5POIi3w/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 cake-php+unsubscr...@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.


-- 
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+unsubscr...@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.


Re: Looking for Help with Cakephp basics .. aka looking for a mentor

2013-12-20 Thread Silver Troy
Hello Reuben,
  I want to thank you for that well thought reply, the answers and pointers 
you have given me.  I really do try and find the answers through google, 
the cook book, youtube and irc.  I just know that sometimes people can 
answer your question in a couple minutes that will save you hours of 
wasting your time.
I have read through the cook book a few times already and though it does 
give some basic examples it lacks answering common problems.

I have done the blog tutorial, expanded it with Andrew Perkins youtube 
tutorials to add in authorization.  I have built a basic administration 
section and a user account section with routing (that took way too much 
time messing around).  I have been able to create form dropdowns that get 
populated from other models, and I recognize the 
data['User']['purchased']['year']  from the examples.  I have built a 
number of different sections like products, manufacturers, dealers, deals, 
users using the basic scaffolding.  

I do need to get into the Category Tree Structure, which I have looked into 
a number of examples, going to need to implement Pagination, Breadcrumbs 
and a proper Search tool (that works with multi-word searches).  Not to 
mention uploading multiple images for a product with a main (or default) 
image set.  I have been looking into using a plugin to do the image upload 
but that has been challenging to get one installed and working properly.

The next time I post .. I will keep it to one problem and try and layout 
what I have done.

Have a good Christmas.


-- 
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+unsubscr...@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.


Re: Looking for Help with Cakephp basics .. aka looking for a mentor

2013-12-18 Thread Reuben
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.

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.

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 

Re: Looking for Help with Cakephp basics .. aka looking for a mentor

2013-12-18 Thread rchavik
awesome answer reuben

+69

-- 
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+unsubscr...@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.


Looking for Help with Cakephp basics .. aka looking for a mentor

2013-12-17 Thread Silver Troy
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+unsubscr...@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.