I've checked your function and it works for me. What cake do you use? And try to print_r $archives in the controller action - may be problems with $latest var in the view. You can easily find any info at http://book.cakephp.org and at the code ;)
On 20 мар, 19:13, Kevin Vandenborne <[email protected]> wrote: > Hey, sorry to bother with this little question but i can't find what's wrong > with the following method, it's working but it's suppose to limit the > results to 5 - but It's giving all of them. > > <?phpfunction _renderBlogLatest() > { > Cache::set(array('duration' => '+30 days')); > $archives = Cache::read('PostsController-index-archives'); > if(empty($archives)) > { > Cache::delete('PostsController-index-archives'); > > $archives = $this->Post->find('all',array( > 'limit' => 5, > 'fields' => array( > 'Post.url', 'Post.name', > 'Post.created' > ), > 'order' => 'Post.created DESC' > ) > ); > Cache::set(array('duration' => '+30 days')); > Cache::write('PostsController-index-archives', $archives); > } > $this->set('latest', $archives); > }?> > > I cleared the cache before refreshing the page so it's not a cache problem > that shows results from before i added the limit. > Also I've asked the same at ask.cakephp.org but i didn't get any answers > there. I'm kind of wanting to switch to zend, it seems the cakephp community > is allot less active and all tutorials are outdated. I'm learning cakePHP > for an internship at a company that uses it, at first i liked it and kind of > still do but there is a lack of documentation and help - specifically with > ajax & jquery integration and I'm afraid it is going to limit me at some > point. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
