In controller
$this-set('most_viewed', $this-Post-find('all', array('limit' = 10,
'order' = array('Post.views' = 'DESC')));
In view
$most_view - your top 10
And don't forget add index to posts.views column in db
2010/9/1 Dave Maharaj m...@davemaharaj.com
I am stumped on how to get top 10
Explanation: Sort your posts table by views column in descendent order and
take only first ten.
2010/9/1 Hellbot g.hell...@gmail.com
In controller
$this-set('most_viewed', $this-Post-find('all', array('limit' = 10,
'order' = array('Post.views' = 'DESC')));
In view
$most_view - your top 10
Hi, i haven't checked this code, but as far as i remember
function beforeFilter() {
if (!isset($this-params[Configure::read('Routing.admin')])) {
$this-Auth-allowedActions = array('*');
}
On Sat, Sep 27, 2008 at 1:58 AM, ORCC [EMAIL PROTECTED] wrote:
I'm using
http://groups.google.com/group/cake-php/browse_thread/thread/abec423ee6a9057a
2007/9/11, guigouz [EMAIL PROTECTED]:
I'm writing a little catalog for a client, and setup Section and
Product controllers with admin routing, so /admin/sections manages
sections and /admin/products manages
Hi,
now you need to declare what named arguments you want
in BulletinsController:beforeFilter
Router::connectNamed(array('bulletin_id'));
2007/9/11, [EMAIL PROTECTED] [EMAIL PROTECTED]:
Thanks, I was not aware of the new explicit nature.
On Sep 10, 5:15 pm, biesbjerg [EMAIL
Router::connect('/admin/', array(CAKE_ADMIN = true, 'controller' =
'photos', 'action' = 'index'));
2007/7/8, [EMAIL PROTECTED] [EMAIL PROTECTED]:
I need to route '/admin' to '/admin/photos/index' in my routes table.
Is this possible? I'm using CakePHP admin routes.
Hello, quote from
http://manual.cakephp.org/chapter/models
afterFind
Use this callback to modify results that have been returned from a
find operation, or perform any other post-find logic. The parameter
for this function is the returned results from the model's find
operation, and the return
Into the Controller::beforeFilter for example
$this-Session-activate();
And into the Views before you need it
$session-activate();
2007/5/28, Przemek [EMAIL PROTECTED]:
Hello,
In my core.php file I set AUTO_SESSION to 'false' because I have to
start session manually after 'require_once'
Depends on version cakePHP
for 1.1.x in ModelController:
$this-ModelName-id = null;
$this-ModelName-save(array('fieldName' = $fieldValue));
for 1.2.x in ModelController:
$this-ModelName-create(array('fieldName' = $fieldValue));
$this-ModelName-save();
2007/5/23, Dazweeja [EMAIL PROTECTED]:
$telephone = $this-NameOfModel-read('tel',$id);
my favorite :)
2007/5/18, Walker Hamilton [EMAIL PROTECTED]:
I love this one: $this-NameOfModel-id = $id;
$telephone = $this-NameOfModel-field('tel');
didn't know about it until you mentioned it.I guess I still don't
completely
as i known
'dependent' - must be a boolean (not a string)
and you don't need to specify default parameter in model::delete function
?php
class Inventory extends AppModel {
var $name = 'Inventory';
var $validate = array(
'title' = VALID_NOT_EMPTY,
Hello, everyone!
I'm trying to build an Access Control Tree :-) looking like this:
actions
- - controller
- - - - add
- - another
- - - - add
and setup the following rights for users:
supervisor has full access to actions
user has full access to controller and no access to another.
Here is
http://www.avatarfinancial.com/pages/cake/
Quote:
I needed to create several pages that didn't use any models and
contained static data inside the default layout. My first thought was
to create a controller for these pages and define an action for each
static page I needed. However, this
http://cakephp.org/screencasts/view/5
On 8 май, 11:50, Jitu [EMAIL PROTECTED] wrote:
How can we create sub module into cakephp. I want ot create an admin
section for my website likewww.mywebsite.com/admin/. So, how can I
configure a folder named admin into my main website.
I'm not sure how this fits the ideology of CakePHP :), but you can create a
directory /admin inside the application webroot and then just use .htaccess
.htpasswd to password-protect the admin methods.
2007/5/8, Floyd [EMAIL PROTECTED]:
Ok Hellbot but this screencasts only show how to use
15 matches
Mail list logo