-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
8 additions
and
324 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file was deleted.
Oops, something went wrong.