Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Bricolage: users

Category ID by URI

 

 

Bricolage users RSS feed   Index | Next | Previous | View Threaded


smith_t at denison

Jul 17, 2008, 6:15 AM

Post #1 of 5 (240 views)
Permalink
Category ID by URI

Whats the easiest way to get a Category ID with the URI? I've tried
consulting the API and found this page:
http://www.bricolage.cc/docs/current/api/Bric/Biz/Category.html

But I don't seem to find what I think I need. This function appears
to return the Category object:
@objs = list Bric::Biz::Category($crit);

This is different then the Category ID, right?

-Trevor


greg at node79

Jul 17, 2008, 6:40 AM

Post #2 of 5 (226 views)
Permalink
Re: Category ID by URI [In reply to]

Hi Trevor,

> But I don't seem to find what I think I need. This function appears
> to return the Category object:
> @objs = list Bric::Biz::Category($crit);
>
> This is different then the Category ID, right?

The list_ids() method previously discussed would be what you're
looking for:

@category_ids = Bric::Biz::Category->list_ids({ uri => '/my/uri/' });
$m->out("my category ID is ".$category_ids[0]) if
scalar(@category_ids)>0;

lookup() is similar to list(), returning a category object, but will
throw an error if more than one category matches. So if you need a
guaranteed one-or-nothing match, use lookup() and then get_id() on the
category object it returns.

All three functions accept the same list of parameters in the hash.


smith_t at denison

Jul 17, 2008, 1:54 PM

Post #3 of 5 (227 views)
Permalink
Re: Category ID by URI [In reply to]

Thanks!

On Thu, Jul 17, 2008 at 9:40 AM, Greg Heo <greg[at]node79.com> wrote:
> Hi Trevor,
>
>> But I don't seem to find what I think I need. This function appears
>> to return the Category object:
>> @objs = list Bric::Biz::Category($crit);
>>
>> This is different then the Category ID, right?
>
> The list_ids() method previously discussed would be what you're looking for:
>
> @category_ids = Bric::Biz::Category->list_ids({ uri => '/my/uri/' });
> $m->out("my category ID is ".$category_ids[0]) if scalar(@category_ids)>0;
>
> lookup() is similar to list(), returning a category object, but will throw
> an error if more than one category matches. So if you need a guaranteed
> one-or-nothing match, use lookup() and then get_id() on the category object
> it returns.
>
> All three functions accept the same list of parameters in the hash.
>
>


smith_t at denison

Jul 17, 2008, 1:54 PM

Post #4 of 5 (227 views)
Permalink
Re: Category ID by URI [In reply to]

Thanks!

On Thu, Jul 17, 2008 at 9:40 AM, Greg Heo <greg[at]node79.com> wrote:
> Hi Trevor,
>
>> But I don't seem to find what I think I need. This function appears
>> to return the Category object:
>> @objs = list Bric::Biz::Category($crit);
>>
>> This is different then the Category ID, right?
>
> The list_ids() method previously discussed would be what you're looking for:
>
> @category_ids = Bric::Biz::Category->list_ids({ uri => '/my/uri/' });
> $m->out("my category ID is ".$category_ids[0]) if scalar(@category_ids)>0;
>
> lookup() is similar to list(), returning a category object, but will throw
> an error if more than one category matches. So if you need a guaranteed
> one-or-nothing match, use lookup() and then get_id() on the category object
> it returns.
>
> All three functions accept the same list of parameters in the hash.
>
>


smith_t at denison

Jul 17, 2008, 1:54 PM

Post #5 of 5 (225 views)
Permalink
Re: Category ID by URI [In reply to]

Thanks!

On Thu, Jul 17, 2008 at 9:40 AM, Greg Heo <greg[at]node79.com> wrote:
> Hi Trevor,
>
>> But I don't seem to find what I think I need. This function appears
>> to return the Category object:
>> @objs = list Bric::Biz::Category($crit);
>>
>> This is different then the Category ID, right?
>
> The list_ids() method previously discussed would be what you're looking for:
>
> @category_ids = Bric::Biz::Category->list_ids({ uri => '/my/uri/' });
> $m->out("my category ID is ".$category_ids[0]) if scalar(@category_ids)>0;
>
> lookup() is similar to list(), returning a category object, but will throw
> an error if more than one category matches. So if you need a guaranteed
> one-or-nothing match, use lookup() and then get_id() on the category object
> it returns.
>
> All three functions accept the same list of parameters in the hash.
>
>

Bricolage users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.