Mailing List Archive

How to use get_containers()
I've used the get_container() method in the past, but can't get the
get_containers() method working. I have a story type with several
'fp_sidebar_box' container elements in it. I can fetch and output
these with 'my @fp_sidebar_box1 = $element-
>get_container('fp_sidebar_box',1); ', replacing 1 with 2, 3, etc. as
necessary. But reading the documentation it looked like I should be
able to do ' my @fp_sidebar_boxes = $element-
>get_containers(qw('fp_sidebar_box'));' and then loop through that
array to get each element. However, that doesn't seem to return
anything. What am I doing wrong?

Thanks,
Tom

PS: I initially tried using $story->get_containers() but that gave the
error 'Can't locate object method "get_containers" via package
"Bric::Biz::Asset::Business::Story"'. So I used $element instead as I
say it was at http://www.bricolagecms.org/docs/2.0/api/Bric/Biz/Element/Container.html
in the API.
Re: How to use get_containers() [ In reply to ]
On 2011-06-16, at 10:19 AM, Tom Ash wrote:

> I've used the get_container() method in the past, but can't get the get_containers() method working. I have a story type with several 'fp_sidebar_box' container elements in it. I can fetch and output these with 'my @fp_sidebar_box1 = $element->get_container('fp_sidebar_box',1); ', replacing 1 with 2, 3, etc. as necessary. But reading the documentation it looked like I should be able to do ' my @fp_sidebar_boxes = $element->get_containers(qw('fp_sidebar_box'));' and then loop through that array to get each element. However, that doesn't seem to return anything. What am I doing wrong?

Want to shoot over a code snippet?

--
Phillip Smith
http://phillipadsmith.com
http://twitter.com/phillipadsmith
http://linkedin.com/in/phillipadsmith
Re: How to use get_containers() [ In reply to ]
Hi Phillip,

Never mind, it seems to work now - which is strange as I can't see
what's changed. Can you point me to an explanation of what master
variables (like $story and $element) are available in what templates,
and what methods are available on each?

Thanks,
Tom

On 16 Jun 2011, at 16:01, Phillip Smith wrote:

>
> On 2011-06-16, at 10:19 AM, Tom Ash wrote:
>
>> I've used the get_container() method in the past, but can't get the
>> get_containers() method working. I have a story type with several
>> 'fp_sidebar_box' container elements in it. I can fetch and output
>> these with 'my @fp_sidebar_box1 = $element-
>> >get_container('fp_sidebar_box',1); ', replacing 1 with 2, 3, etc.
>> as necessary. But reading the documentation it looked like I should
>> be able to do ' my @fp_sidebar_boxes = $element-
>> >get_containers(qw('fp_sidebar_box'));' and then loop through that
>> array to get each element. However, that doesn't seem to return
>> anything. What am I doing wrong?
>
> Want to shoot over a code snippet?
>
> --
> Phillip Smith
> http://phillipadsmith.com
> http://twitter.com/phillipadsmith
> http://linkedin.com/in/phillipadsmith
>
>
>
>
>
>
>