Nice article!
the cake is drawing more and more interest
I found to work well with simple models!
Also Jonathan Snook is starting a new blog about CakePHP: http://withcake.com/
| SitePoint Sponsor |

Nice article!
the cake is drawing more and more interest
I found to work well with simple models!
Also Jonathan Snook is starting a new blog about CakePHP: http://withcake.com/
I've read up on cake a little more now. And as most other frameworks I've tried, it fails when it comes to caching. It might just be me, but I need caching to work, and I need it to work the right way.
from the cake manual:
This is fine if you run an article site, or a blog. But as soon as you start doing something a bit more complex it gets unusable. IE you have a download site with downloads listed. Of course you keep track of the downloads and present this to the users. the more downloads you have, the longer time it takes for php/mysql (I'm usually using mysql) to process this. You might not notice this at the beginning, as the site is small. But as soon as you start getting more users, it will be a drag. Caching the list and make it update every hour will save you A LOT of processing power. The more users the more processing power you save. I run a site which have a usual load of 80-120 users. When these users hammer a download list, caching saves my dedicated server from going down. I had huge issues with load until I implented caching at some parts of the site. It saved me from investing into another dedicated server and set up loadbalancingFirst, you should be aware that Cake will automatically clear the cache if a database change has been made. For example, if one of your views uses information from your Post model, and there has been an INSERT, UPDATE, or DELETE made to a Post, Cake will clear the cache for that view.
Caching is a big moneysaver, and I see it as the most important backend part of a site (next to session handling). If I can save $400 a month on servers because of cache, I will use it. And I will use it on every project, no matter how small. Never know if a small project grows big. If a frameworks caching can't be used, the framework can't be used. I'd rather use a framework without caching and build my own caching library. And I won't use a framework that implements an unusable caching engine. It bloats the engine code and it makes me wonder about the rest of the code.
chrome is a wrapper that combines a browser with spyware
The nice thing about the current caching is you use it only when you want, you have to turn it on, so using your own caching system is very easy. There is also specifc code you can use to not cache a specific part of your page.Originally Posted by -T-
simple example:
http://cakephp.org/pastes/show/6f197...41781ac5078557
The example you used above would be very easy to implement and cache a specific part of the page being displayed while keeping another section dynamic.
Another suggestion, if you see something you have a question about, stop by our freenode.net irc channel #cakephp I am there often, or visit the google group http://groups.google.com/group/cake-php.
A feature request or bug report is handled on the trac site https://trac.cakephp.org/
Why would I use 2 caching engines in one aplication? I'd rather have one that can do what I want it to do. And to be honest, I prefer a framework with a minimal of functions and a library at the side were you pick the functions you want. This will lower cpu and memory usage a lot and help maintain fast and slick aplications. I find a lot of the frameworks are built to speed up the work at the loss of quality. To me, speed and security comes first. The frameworks I've tried up to now have not been able to deliver that.
chrome is a wrapper that combines a browser with spyware
I think you misunderstood me, there is nothing forcing you to use the included caching, and you must turn it on to use it, I said nothing about using 2 caching engines, re-read my post. The core caching is not even loaded unless you need it. Same with the rest of the core framework code only what is needed is loaded.Originally Posted by -T-
To me a framework is not only libraries but a set of conventions that make it easier to build your application, by sticking with these conventions you will see application development is much easier and faster. There is nothing forcing you to use these conventions, but by not using them it will make development harder trying to use a framework built as Cake is, not only that, you will write more code trying not to use these conventions, which defeats the purpose of using a framework in the first place IMO.And to be honest, I prefer a framework with a minimal of functions and a library at the side were you pick the functions you want.
Cake adds structure to an unstructured language, and those who use it could not agree more that this structure has been a blessing for them in their daily development activities.
What you describe as wanting in a framework is nothing more then PHP itself...
I should have done this to begin with, showed you an example...
And all is well in your application...PHP Code:<?php
class Download extends Appmodel{
var $name = 'Download';
function _clearCache($type = null){
//since we are overriding the Model::_clearCache() cache will remain
//until the time set to delete cache is reached
}
}
?>
Originally Posted by spinmaster
Thanks for introducing me to CodeIgniter. It's exactly what I needed.
Last edited by pixelguru; Jul 16, 2006 at 12:09. Reason: add original message
Is anyone going to offer a solution to this problem? Two people so far have had it. Make me 3. Probably loads more...Originally Posted by arbel
ok, after a quick play I think I can answer my own question
in your apache config file uncomment the following (approx line no in brackets)
(192) LoadModule rewrite_module modules/mod_rewrite.so
(237) AddModule mod_rewrite.c
mine now seems to work
BUT I'm no apache expert so perhaps someone more knowledgable can confirm this is the correct/safe thing to do.
T




Yep I was going to suggest that it may be happening because your Apache install does not have mod_rewrite installed, but you beat me to it. Cake needs that module to work correctly.Originally Posted by timboreader
Not sure what version of Apache you are running, but I don't think this is necessary, just the LoadModule call.Originally Posted by timboreader
Last edited by mattymcg; Jul 19, 2006 at 20:41.
I design beautiful, usable interfaces. Oh, and I wrote a kids' book.
• Follow me on Twitter.
• Read my blog.
• Buy my book, Charlie Weatherburn and the Flying Machine.
If you remove the comment from the BASE_URL define in app/config/core.php you can use CakePHP without mod rewrite.Originally Posted by mattymcg
URLS would be www.example.com/index.php/notes in this article example then
Most of this is covered in the manual. http://manual.cakephp.org/
This doesn't work with Windows/Apache2.2, where even the php4apache2.dll downloaded from php.net doesn't work (it's said this file is for Apache2.0, you can download a 2.2 replacement from http://www.apachelounge.com/download/).Originally Posted by mattymcg
The example view shows up only on http://localhost/index.php?url=notes. So it seems the mod_rewrite isn't working.


Bump for truth.Originally Posted by rhenkel
- Create two class files
- ???
- Profit!
I'm using IIS. Is there something I'm missing or does the article assume I've taken other steps?
Edit: The article mentions that IIS is supported by cake, but the solutions so far involve Apache and mod_rewrite. Is this article dependant on mod_rewrite?
1. Please check http://ask-leo.com/does_iis_support_url_rewriting.html for more details.Originally Posted by an00bis
2. This tutorial depends on mod_rewrite if you want it work just as taught to show something with only two files added. A way around mod_rewrite is try this link
http://localhost/index.php?url=notes. And then when you add more views, e.g. add, edit, you manully change the link by inserting "index.php?url=".
3. The answer to the post above is
when changing httpd.conf, besidesThe example view shows up only on http://localhost/index.php?url=notes. So it seems the mod_rewrite isn't working.
LoadModule rewrite_module libexec/httpd/mod_rewrite.so
AddModule mod_rewrite.c (not needed for Apache 2.2)
Make sure the AllowOverride is set to All for the correct Directory.
Another answer concerns anoobis's question:
http://wiki.cakephp.org/tutorials:ca...ithout_rewrite
Last edited by phpnut2; Aug 4, 2006 at 12:01. Reason: add title


You should update your links. Instead of http://manual.cakephp.org/pages/ch12, it's now http://manual.cakephp.org/chapter/12.
In the rest, it's a fine article, thanks for that.





What has annoyed me so far after getting stuck in today, is the case-sensitivity of application names. DVDs and Dvds are not the same.
File: /app/model/dvd.php
File: /app/controller/dvds_controller.phpPHP Code:<?php
class Dvd extends AppModel
{
var $name = 'Dvd';
}
?>
I have yet to get it working where it recognizes the applaction as a database of DVDs and not Dvds (and yes I have played around with the case in the class names.PHP Code:<?php
class DvdsController extends AppController
{
var $name = 'Dvds';
var $scaffold;
}
?>


Thanks for the tip, phpnut2. I hadn't thought of using a PERL redirect. I'll give it another go round.
Are you also phpnut from the cake screencasts? If so, thanks again!
I believe
var $uses = array(Note, AnotherModel, YetAnotherModel);
should be
var $uses = array('Note', 'AnotherModel', 'YetAnotherModel');
Hmm?
(just a little picky thing, I'm reading the article right now and noticed it)
The above message fixed the problem I was having ... I had to remove all the htaccess files also. Strange thing for me was that something view were working and others were not. I check my code over and over again and everything looked fine but I would get a 404 error when trying to access some pages. Once I turned on the BASE_URL then all pages would work without error. This tells me that something was wrong with server configuration and not a problem with my code.Originally Posted by 1PhpNut
It's a greate help for those who are new in MVC or such type of aechitecture.


The look and feel of CakePHP has changed since this article.. Was kinda confusing at first to see the screenshots looking (quite!) different! Perhaps you could update the screenshots to match the new look and feel?
cake is one of the many cool php frameworks.
i would suggest checking out the QCodo framework.
And if you are a railsnut check out Akelos.
I just found out about Cake last week, and I have been combing through the CakePHP site and the web to learn more about it. Your article is by far the best I found to explain what it does and cleared up a few questions for me. Thank you!
check out http://codeigniter.com/ and http://www.symfony-project.com/ as well.
Bookmarks