Skip to content

Commit

Permalink
split repos
Browse files Browse the repository at this point in the history
  • Loading branch information
mcurry committed Apr 24, 2009
1 parent 3365a47 commit f99b91d
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 324 deletions.
10 changes: 0 additions & 10 deletions README

This file was deleted.

29 changes: 2 additions & 27 deletions snippets/app_helper_url/README
Original file line number Diff line number Diff line change
@@ -1,27 +1,2 @@
/*
* App Helper url caching
* Copyright (c) 2009 Matt Curry
* www.PseudoCoder.com
* http://github.com/mcurry/cakephp/tree/master/snippets/app_helper_url
* http://www.pseudocoder.com/archives/2009/02/27/how-to-save-half-a-second-on-every-cakephp-requestand-maintain-reverse-routing
*
* @author Matt Curry <matt@pseudocoder.com>
* @license MIT
*
*/

/* Description */
Whenever you use $html->link() in your CakePHP views the Cake Router has to scan through all your routes until it finds a match.
This can be slow if you have a lot of links on a page or use a lot of custom routes. By adding this code to your AppHelper the urls
are cached, speeding up requests. The cache settings follow the same rules as the other Cake core cache settings.
If debug is set to greater than 0 the cache expires in 10 seconds. With debug at 0 the cache is good for 999 days.

/* Instructions */
1) Drop the code in /app/app_helper.php

2) By default all the cache will be stored in one file.
You can set the option Configure::write('UrlCache.pageFiles', true) and each page will keep a seperate cache.
I added this option in the event your site has a ton of unique urls don't want to store them all in one giant cache,
which would need to be loaded each request.

3) When ever you do new builds delete /app/tmp/cache/persistent/cake_core_url_map
This code has been moved to it's own repository:
http://github.com/mcurry/cakephp_app_helper_url/tree/master
64 changes: 0 additions & 64 deletions snippets/app_helper_url/app_helper.php

This file was deleted.

19 changes: 2 additions & 17 deletions snippets/app_model_associations/README
Original file line number Diff line number Diff line change
@@ -1,17 +1,2 @@
/*
* App Model
* Copyright (c) 2008 Matt Curry
* http://www.pseudocoder.com/archives/2009/04/17/on-the-fly-model-chains-with-cakephp/
*
* @author Matt Curry <matt@pseudocoder.com>
* @license MIT
*
*/

/* Description */
The code is very beta. Please give it a shot and let me know where you hit snags.
I've tested it in basic app using Containable and it works great.
It probably doesn't work with $recursive.

/* Instructions */
1) Drop the snippet in /app/app_model.php
This code has been moved to it's own repository:
http://github.com/mcurry/cakephp_app_model_associations/tree/master
58 changes: 0 additions & 58 deletions snippets/app_model_associations/app_model.php

This file was deleted.

27 changes: 2 additions & 25 deletions snippets/app_model_find/README
Original file line number Diff line number Diff line change
@@ -1,25 +1,2 @@
/*
* App Model custom find types
* Copyright (c) 2008 Matt Curry
* www.PseudoCoder.com
* http://github.com/mcurry/cakephp/tree/master/snippets/app_model_find
* http://www.pseudocoder.com/archives/2008/10/24/cakephp-custom-find-queriescakephp-custom-find-types/
*
* @author Matt Curry <matt@pseudocoder.com>
* @license MIT
*
*/

/* Description */
A CakePHP code snippet that allows for creating custom find types by simply adding a new method to the model.

/* Instructions */
1) Drop the snippet in /app/app_model.php

2) Create find types with the pattern:
$this->Model->find('custom');

3) In your model:
function __findCustom($options) {
//do find here
}
This code has been moved to it's own repository:
http://github.com/mcurry/cakephp_app_model_find/tree/master
28 changes: 0 additions & 28 deletions snippets/app_model_find/app_model.php

This file was deleted.

34 changes: 2 additions & 32 deletions snippets/static_user/README
Original file line number Diff line number Diff line change
@@ -1,32 +1,2 @@
/*
* Static methods that can be used to retrieve the logged in user
* from anywhere
*
* Copyright (c) 2008 Matt Curry
* www.PseudoCoder.com
* http://github.com/mcurry/cakephp/tree/master/snippets/static_user
* http://www.pseudocoder.com/archives/2008/10/06/accessing-user-sessions-from-models-or-anywhere-in-cakephp-revealed/
*
* @author Matt Curry <matt@pseudocoder.com>
* @license MIT
*
*/

/* Description */
A snippet of code that can be dropped into your User model, which will allow you to access the
logged in user from anywhere in a CakePHP app.

/* Notes */
This code assumes you are using the core Auth component.

/* Instructions */
1) Paste the code into your User model.

2) In your AppController::beforeFilter add:
App::import('Model', 'User');
User::store($this->Auth->user());

/* Usage */
User::get('id');
User::get('username');
User::get('Model.fieldname');
This code has been moved to it's own repository:
http://github.com/mcurry/cakephp_static_user/tree/master
63 changes: 0 additions & 63 deletions snippets/static_user/user.php

This file was deleted.

0 comments on commit f99b91d

Please sign in to comment.