opps,... db blogs, field categories getting numbers from bootstrap on
categories select: ....
On Thursday, November 8, 2012 5:00:41 PM UTC-8, Chris wrote:
>
> hi cricket, thank you for your response,... ok this is what I have
> now,...
> in bootstrap:
> Configure::write('Blog.blog_category', array('select categry',
> 'realestate', 'autos', 'appliances', 'antique'));
> which gives me categories in a url: my_site.com/blogs/category/autos
>
> and the blogs db I have field categories array: (I have pulled it by debug)
>
> Array
> (
> [0] => select categry
> [1] => realestate
> [2] => autos
> [3] => appliances
> [4] => antique
> )
>
>
> now I want to display blogs for that categories
>
> function category($id = null)
> {
> $category = $id;
>
> $cat_id = Configure::read('Blog.blog_category');
>
> $cat = $this->Blog->find('list', array('conditions' =>
> array('Blog.categories' => 'category')));
>
>
> debug($cat_id);
>
> debug($cat);
>
> and no response on debug $cat,...
>
>
>
> 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 <[email protected]> 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 [email protected].
>> > To unsubscribe from this group, send email to
>> > [email protected].
>> > 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 [email protected].
To unsubscribe from this group, send email to
[email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en.