Also, you still have a typo, fwiw. On Fri, Nov 9, 2012 at 12:25 PM, Jeremy Burns | Class Outfit <jeremybu...@classoutfit.com> wrote: > I think Cricket's (extremely valid) point is "what happens when you (or one > of those pesky users) wants to add another category?" For a site that's > backed by a database it seems really odd to extract just one small tier of > data out of the data layer. > > Jeremy Burns > Class Outfit > > http://www.classoutfit.com > > On 9 Nov 2012, at 17:06:19, Chris <chris...@yahoo.com> wrote: > > ok cricket,... the problem is solved ,... > I have to read from a bootstrap,.. cause my categories setup is from > bootstrap, and much easy to setup in bootstrap,... > so this is what I have,... in case anyone wonder,... > > bootstrap: > Configure::write('Blog.blog_category', array('select categry', > 'realestate', 'autos', 'appliances', 'antique')); > > and in my conroller: > > function category($id = null) > { > if($this->is_user()) > { > $this->set('user_obj', $user = > $this->User->findById($this->user['id'])); > } > > $category = $id; > > $cat_id = array_search($category, > Configure::read('Blog.blog_category')); > > $this->set('category', $category); > > $blogs = $this->Blog->find('all', array('conditions' => > array('Blog.categories' => $cat_id))); > > $this->set('blogs', $blogs, $this->paginate()); > > } > > > ok,... now I'm having a problem with paginator,... but that's later,... ;) > > thank you for your response cricket,... > salute > chris > > > > On Thursday, November 8, 2012 3:29:56 PM UTC-8, cricket wrote: >> >> I don't understand quite what you're trying to do (what is >> array_search for?) but there's a typo: 'select categry' >> >> Instead of hard-coding your categories, why not just get them from the >> DB? You can always write the list to cache and update it whenever the >> categories change. >> >> On Thu, Nov 8, 2012 at 4:20 PM, Chris <chri...@yahoo.com> wrote: >> > hi guys,... >> > I have a problem of displaying blogs by categories,... can someone help >> > me >> > please,... >> > I'm in cake 1.3 >> > >> > have a categories setup in db from bootstrap: >> > Configure::write('Blog.blog_category', array('select categry', >> > 'realestate', 'autos', 'appliances', 'antique')); // etc,... >> > >> > I want to display blogs by categories, and I got to the point of reading >> > category in URL,... but can not display blogs by categories,... here is >> > my >> > controller: >> > >> > function category($id = null) >> > { >> > $category = $id; >> > >> > $conditions = array(array_search('category', >> > Configure::read('Blog.blog_category') )); >> > >> > debug($conditions); >> > >> > $scope = array('Blog.id' => $conditions); >> > >> > $blogs = $this->paginate('Blog', $scope); >> > >> > $this->set('blogs', $blogs); >> > >> > } >> > on debug conditions I'm getting >> > >> > Array >> > ( >> > [0] => >> > ) >> > >> > >> > thank you in advance >> > >> > -- >> > Like Us on FaceBook https://www.facebook.com/CakePHP >> > Find us on Twitter http://twitter.com/CakePHP >> > >> > --- >> > You received this message because you are subscribed to the Google >> > Groups >> > "CakePHP" group. >> > To post to this group, send email to cake...@googlegroups.com. >> > To unsubscribe from this group, send email to >> > cake-php+u...@googlegroups.com. >> > Visit this group at http://groups.google.com/group/cake-php?hl=en. >> > >> > > > > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To post to this group, send email to cake-php@googlegroups.com. > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > > > > > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To post to this group, send email to cake-php@googlegroups.com. > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > >
-- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.