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

Mailing List Archive: Bricolage: users

Deleting containers or elements via a template

 

 

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


acaul at rand

May 15, 2009, 7:23 AM

Post #1 of 3 (884 views)
Permalink
Deleting containers or elements via a template

I am looping through an array of stories, and for each one I want to
delete some of its subelements.

$rs is each story.

$subelem = $rs->get_container("mysub");
foreach my $subb ($subelem->get_containers) {
my $e = $subb->get_element;
$e->delete;
$subb->save();
$rs->save();
}


This did not work. The error message is

Bad AUTOLOAD method format: Bric::Biz::ElementType::delete


Any ideas?

__________________________________________________________________________

This email message is for the sole use of the intended recipient(s) and
may contain confidential information. Any unauthorized review, use,
disclosure or distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply email and destroy all copies
of the original message.


bret at pectopah

May 15, 2009, 7:40 AM

Post #2 of 3 (807 views)
Permalink
Re: Deleting containers or elements via a template [In reply to]

Hi Ashlee,

If you want to remove every container inside a "mysub" container, you
can do that like this:

$subelem = $rs->get_container("mysub");
my @kill_list = $subelem->get_containers;
$subelem->delete_elements(\@kill_list);
$subelem->save;

Hope this helps,

Bret




On Fri, 2009-05-15 at 10:23 -0400, Ashlee Caul wrote:
> I am looping through an array of stories, and for each one I want to
> delete some of its subelements.
>
> $rs is each story.
>
> $subelem = $rs->get_container("mysub");
> foreach my $subb ($subelem->get_containers) {
> my $e = $subb->get_element;
> $e->delete;
> $subb->save();
> $rs->save();
> }
>
>
> This did not work. The error message is
>
> Bad AUTOLOAD method format: Bric::Biz::ElementType::delete
>
>
> Any ideas?
>
> __________________________________________________________________________
>
> This email message is for the sole use of the intended recipient(s) and
> may contain confidential information. Any unauthorized review, use,
> disclosure or distribution is prohibited. If you are not the intended
> recipient, please contact the sender by reply email and destroy all copies
> of the original message.
--
Bret Dawson
Producer
Pectopah Productions Inc.
(416) 895-7635
bret [at] pectopah
www.pectopah.com


acaul at rand

May 15, 2009, 8:35 AM

Post #3 of 3 (811 views)
Permalink
Re: Deleting containers or elements via a template [In reply to]

Great! That worked! Thanks!

On May 15, 2009, at 10:40 AM, Bret Dawson wrote:

> Hi Ashlee,
>
> If you want to remove every container inside a "mysub" container, you
> can do that like this:
>
> $subelem = $rs->get_container("mysub");
> my @kill_list = $subelem->get_containers;
> $subelem->delete_elements(\@kill_list);
> $subelem->save;
>
> Hope this helps,
>
> Bret
>
>
>
>
> On Fri, 2009-05-15 at 10:23 -0400, Ashlee Caul wrote:
>> I am looping through an array of stories, and for each one I want to
>> delete some of its subelements.
>>
>> $rs is each story.
>>
>> $subelem = $rs->get_container("mysub");
>> foreach my $subb ($subelem->get_containers) {
>> my $e = $subb->get_element;
>> $e->delete;
>> $subb->save();
>> $rs->save();
>> }
>>
>>
>> This did not work. The error message is
>>
>> Bad AUTOLOAD method format: Bric::Biz::ElementType::delete
>>
>>
>> Any ideas?
>>
>> _____________________________________________________________________
>> _____
>>
>> This email message is for the sole use of the intended recipient
>> (s) and
>> may contain confidential information. Any unauthorized review, use,
>> disclosure or distribution is prohibited. If you are not the intended
>> recipient, please contact the sender by reply email and destroy
>> all copies
>> of the original message.
> --
> Bret Dawson
> Producer
> Pectopah Productions Inc.
> (416) 895-7635
> bret [at] pectopah
> www.pectopah.com
>

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


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.