
phillip at communitybandwidth
Jul 16, 2008, 9:21 AM
Post #20 of 21
(479 views)
Permalink
|
Trevor, Have you taken a look at the archive_list.mc template from the bricolage.cc templates: https://www.buildingbrics.com/trac/browser/trunk/example_sites/bricolage.cc-1.4/templates/Library/util/archive_list.mc I adjusted this at one point to allow multiple categories. The other approach is just to use it once for each category (if there are only a few). Phillip. On 16-Jul-08, at 11:49 AM, Trevor Smith wrote: > I'm trying to use what you suggested in this code to return a list of > all the stories in these three directories: > > my $subcat = Bric::Biz::Category->list_ids({ uri => > '/offices/computing/facilities/computerlabs/' }); > @stories = Bric::Biz::Asset::Business::Story->list({ category_id => > $subcat, active => 1, unexpired => 1 }); > $subcat = Bric::Biz::Category->list_ids({ uri => > '/offices/computing/facilities/eclassrooms/' }); > @stories = push(@stories,Bric::Biz::Asset::Business::Story->list({ > category_id => $subcat->get_id, active => 1, unexpired => 1 })); > $subcat = Bric::Biz::Category->list_ids({ uri => > '/offices/computing/facilities/laptopcarts/' }); > @stories = push(@stories,Bric::Biz::Asset::Business::Story->list({ > category_id => $subcat->get_id, active => 1, unexpired => 1 })); > > I keep generating the same SQL error as seen here: > > Unable to execute SQL statement > > Cannot bind a reference (ARRAY(0xfa8eee8)) ((null)) (1) type=7 10 4 0 > at /usr/local/bricolage/lib/Bric/Util/DBI.pm line 1087, <GEN950> line > 460. > > Stack: > [/usr/local/bricolage/lib/Bric/Util/DBI.pm:1087] > [/usr/local/bricolage/lib/Bric/Util/DBI.pm:730] > [/usr/local/bricolage/lib/Bric/Biz/Asset.pm:312] > [/usr/local/bricolage/data/burn/sandbox/user_1368/oc_1/ > software_index.mc:28] > [/usr/local/lib/perl5/site_perl/5.8.8/HTML/Mason/Component.pm:135] > [/usr/local/bricolage/lib/Bric/Util/Burner/Mason.pm:557] > [/usr/local/bricolage/data/burn/sandbox/user_1368/oc_1/autohandler: > 144] > [/usr/local/lib/perl5/site_perl/5.8.8/HTML/Mason/Component.pm:135] > > Another stupid syntax error? Thanks. > > -Trevor > > On Wed, Jul 16, 2008 at 10:42 AM, Lanning, Scott <lannings[at]who.int> > wrote: >> Just instead of using Bric::Biz::Category->list, >> which returns Category objects >> (so you have to call $_->get_id for each object), >> use Bric::Biz::Category->list_ids directly. >> Then the objects aren't created, which is a relatively >> expensive thing to do (if you only need ID numbers). >> >> -----Original Message----- >> From: smith.t.denison[at]gmail.com on behalf of Trevor Smith >> Sent: Wed 7/16/2008 2:17 PM >> To: users[at]lists.bricolage.cc >> Subject: Re: Finding Stories by Type >> >> Can you show me where and how to use this in my code? Thanks. >> >> -Trevor >> >> On Tue, Jul 15, 2008 at 4:44 PM, David E. Wheeler <david[at]kineticode.com >> > wrote: >>> >>> If you don't need the category objects, use Category->list_ids(), >>> instead. >>> Much more efficient. >>> >>> Best, >>> >>> David >>> >> >> -- Phillip Smith, Simplifier of Technology Community Bandwidth http://www.communitybandwidth.ca
|