Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Debuggable Blog:
How to paginate a CakePHP search over a HABTM relation without hacking the core
Nov 21, 2008 @ 22:38:30

On the Debuggable blog Tim Koschutzki has a new post showing how to get CakePHP to play nicely with a HABTM query and pagination.

The problem is that a user inputs some search criteria into a form, the resultset exceeds 30 rows for example and the user must be able to browse through the resultset via different pages. [...] This problem itself is in fact not much of a problem. We just need to store the form conditions somewhere and then hack it together. So what we are going to do is that we raise the difficulty bar a lot more by trying to get the pagination work over a HABTM relation.

Code is included for the model and controller to get the job done.

tagged: habtm relationship controller model cakephp framework

Link:

Chris Hartjes's Blog:
CakePHP Pagination With A HABTM Relationship
Dec 13, 2007 @ 14:48:00

Chris Hartjes has posted a mini-tutorial on working with HABTM (Has And Belongs To Many) relationships in a CakePHP applications alongside pagination.

There are usually lots of Has And Belongs To Many relationship questions on the CakePHP mailing list. Since I am stupid about this stuff, I sought out Nate Abele and bugged him via IM until he agreed to give me an example of how to do this.

He includes both the how and the why, explaining that merging the parameters allows the script to apply the HABTM connections as well as limiting the results for each page.

tagged: cakephp framework habtm relationship database pagination cakephp framework habtm relationship database pagination

Link:

Chris Hartjes's Blog:
CakePHP Pagination With A HABTM Relationship
Dec 13, 2007 @ 14:48:00

Chris Hartjes has posted a mini-tutorial on working with HABTM (Has And Belongs To Many) relationships in a CakePHP applications alongside pagination.

There are usually lots of Has And Belongs To Many relationship questions on the CakePHP mailing list. Since I am stupid about this stuff, I sought out Nate Abele and bugged him via IM until he agreed to give me an example of how to do this.

He includes both the how and the why, explaining that merging the parameters allows the script to apply the HABTM connections as well as limiting the results for each page.

tagged: cakephp framework habtm relationship database pagination cakephp framework habtm relationship database pagination

Link:

The Bakery:
Five New Articles, Tutorials and Helpers
Sep 11, 2007 @ 14:29:00

The Bakery has five new items they've recently posted - a few new articles, helper information and tutorials. Here's the list:

  • CSV Helper - I was recently outputting some comma-delimited data and thought I would benefit from a simple csv helper
  • p28n, the top to bottom persistent internationalization tutorial - For some developers, allowing a website to support multiple languages is essential. Luckily cakePHP 1.2 has the foundations available to make this possible.
  • Tracking navigation history of a user - Many times it can be very useful to track the navigation history of a user. [...] With this HistoryComponent, it's extremely easy to handle such actions.
  • Habtm hacks to menage columns in both models - I had a habtm relationship between two models and when i did a "findall" in a model i couldn't filter the rows with a clause from the the other model.
  • SecureGet Component - I am not pretending this can replace ACL or more complex implementation, it's just a small component, inspired a bit from the Security component.

If you're a CakePHP developer, you'd do well to check out The Bakery for these and more great Cake-related articles, tutorials and information.

tagged: csv internationalization navigation habtm secureget bakery csv internationalization navigation habtm secureget bakery

Link:

The Bakery:
Five New Articles, Tutorials and Helpers
Sep 11, 2007 @ 14:29:00

The Bakery has five new items they've recently posted - a few new articles, helper information and tutorials. Here's the list:

  • CSV Helper - I was recently outputting some comma-delimited data and thought I would benefit from a simple csv helper
  • p28n, the top to bottom persistent internationalization tutorial - For some developers, allowing a website to support multiple languages is essential. Luckily cakePHP 1.2 has the foundations available to make this possible.
  • Tracking navigation history of a user - Many times it can be very useful to track the navigation history of a user. [...] With this HistoryComponent, it's extremely easy to handle such actions.
  • Habtm hacks to menage columns in both models - I had a habtm relationship between two models and when i did a "findall" in a model i couldn't filter the rows with a clause from the the other model.
  • SecureGet Component - I am not pretending this can replace ACL or more complex implementation, it's just a small component, inspired a bit from the Security component.

If you're a CakePHP developer, you'd do well to check out The Bakery for these and more great Cake-related articles, tutorials and information.

tagged: csv internationalization navigation habtm secureget bakery csv internationalization navigation habtm secureget bakery

Link:

The Bakery:
Five More Articles/Tutorials Posted
Aug 21, 2007 @ 15:25:00

The Bakery has five more great articles/tutorials they've posted recently covering topics like authentication and cross-controller input validation. Here's the list:

  • Obvious trick to reduce amount of HABTM relationship tables - Trick howto reduce amount of HABTM tables in complex application
  • Validation in another controller - You have 2 controllers, posts and comments, you want to be able to have a form on a posts view which submits to the comments controller, which does its thing then redirect to referrer - easy!
  • ConditionalValidation behavior - The validations in cake 1.2 are great, but sometimes I needed to have conditional validation. Because the validations are set at model level, i did implement a behavior that allows to turn on or off validation.
  • obAuth Simple Authentication - Authenticate your users and secure your controller actions from users belonging to certain groups. Or simply secure your controller actions to let any authenticated user to access it.
  • obAuth Component Tutorial - This is a tutorial on how to use obAuth component: http://bakery.cakephp.org/articles/view/130

Check out The Bakery for more information on these and other great CakePHP-related articles, tutorials and commentary.

tagged: habtm relationship validation obauth component cakephp bakery habtm relationship validation obauth component cakephp bakery

Link:

The Bakery:
Five More Articles/Tutorials Posted
Aug 21, 2007 @ 15:25:00

The Bakery has five more great articles/tutorials they've posted recently covering topics like authentication and cross-controller input validation. Here's the list:

  • Obvious trick to reduce amount of HABTM relationship tables - Trick howto reduce amount of HABTM tables in complex application
  • Validation in another controller - You have 2 controllers, posts and comments, you want to be able to have a form on a posts view which submits to the comments controller, which does its thing then redirect to referrer - easy!
  • ConditionalValidation behavior - The validations in cake 1.2 are great, but sometimes I needed to have conditional validation. Because the validations are set at model level, i did implement a behavior that allows to turn on or off validation.
  • obAuth Simple Authentication - Authenticate your users and secure your controller actions from users belonging to certain groups. Or simply secure your controller actions to let any authenticated user to access it.
  • obAuth Component Tutorial - This is a tutorial on how to use obAuth component: http://bakery.cakephp.org/articles/view/130

Check out The Bakery for more information on these and other great CakePHP-related articles, tutorials and commentary.

tagged: habtm relationship validation obauth component cakephp bakery habtm relationship validation obauth component cakephp bakery

Link:


Trending Topics: