[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bricolage-general
Subject:    RE: Container and Fields not available from inside template
From:       Adam Wilson <adam () RFXTechnologies ! com>
Date:       2011-09-05 20:22:29
Message-ID: A4CD0E1AC39CDF458D629D396E59C838953E2D13 () Morbo2010 ! RFX-Tech ! com
[Download RAW message or body]

Brian,
	I totally sympathize with your situation.  As great of a system as I think Bricolage \
is, I also think it is naturally complicated to try to learn because of it's \
capabilities.

	When you ask the system to burn an element, the template is called within that \
context.  When you ask the system to call a template, it doesn't assume that just \
because there is an element by the same name, that element should be used.  Imagine \
the interesting results if there were more than one element on the page by the same \
name.  How would it know which element to use?  I have lots of story elements that \
contain lots of different paragraphs, for example a paragraph might be inside of a \
list item, or it might be inside of an image with a caption, or it might be just a \
paragraph.

	This list has always been very supportive, and I still have a lot to learn myself.  \
It makes it much easier to approach learning Bricolage when you know there are people \
you can turn to in time of need.

Adam

-----Original Message-----
From: users@lists.bricolagecms.org [mailto:users@lists.bricolagecms.org] On Behalf Of \
                Brian Percival
Sent: Monday, September 05, 2011 3:32 PM
To: users@lists.bricolagecms.org
Subject: Re: Container and Fields not available from inside template associated with \
Element Type

Thanks Adam,

Any assistance is surely welcome. As I said, I'm very new to Bricolage and I've found \
very little as far as tutorials on Bricolage. I actually did see the display_element \
method in the api and I will give it a try. I just made the assumption that an \
element template for an element type would be in the context of that element. Oh \
well. live and learn. Thank goodness for this mailing list!

Brian

On Mon, Sep 5, 2011 at 3:04 PM, Adam Wilson <adam@rfxtechnologies.com>wrote:

> Brian,
> Sounds like David might have insider information that is far better 
> than I what I am about to pass along.
> 
> However, if I read through your description correctly, it sounds like 
> you are calling the new template you created using % $m->comp('/util/ 
> fb_metadata.mc'), but if you want the context to be the element that 
> the template is supposed to apply to, I think you have to call it 
> using $burner->chain_next, or to be more judicious in what you are 
> doing, since it is buried in a utility template, wrap it in the foreach statement.
> 
> % foreach my $e ($story->get_elements("fb_metadata ")) {
> %       $burner->display_element($e);
> % }
> 
> Adam
> 
> -----Original Message-----
> From: users@lists.bricolagecms.org 
> [mailto:users@lists.bricolagecms.org]
> On Behalf Of Brian Percival
> Sent: Monday, September 05, 2011 2:01 PM
> To: users@lists.bricolagecms.org
> Subject: Re: Container and Fields not available from inside template 
> associated with Element Type
> 
> Thanks for the reply David.
> I'm very new at Bricolage so I'll try my best to answer your questions.
> Yes, I edited an existing story and added a fb_metadata and an fb_image.
> 
> I have a template for my story element. This entire system has 
> actually been around.
> This is for Education Week  which I know you have access to our system.
> Since I've inherited this, there is a utility template that is 
> included in the story template.
> I'm not sure why they made it a utility template. It writes out all 
> the pages metadata.
> 
> My template (fb_metadata) writes out a bunch of metadata elements for 
> Facebook and so it just made sense for me to include it in the other 
> metadata template and also to save time not having to go back and 
> include it in all the other templates.
> 
> I created my templates as an element template mainly because I thought 
> I'd have access to the elements and fields, Interestingly, although 
> the admin screen shows the fb_metadata as the Key Name, the 
> $element->get_key_name actually shows ew_story as the value.
> 
> perhaps it would just be easier to add it to each story template in 
> each of our output channel?
> 
> Thanks,
> 
> Brian Percival
> 
> 
> 
> 
> On Sat, Sep 3, 2011 at 11:13 PM, David E. Wheeler 
> <david@kineticode.com
> > wrote:
> 
> > On Sep 2, 2011, at 12:56 PM, Brian Percival wrote:
> > 
> > > I have an Element Template associated with an element type.
> > > When I edit the template, I see the element shown "Key Name:
> fb_metadata"
> > > and the one field I have listed "Field Elements: fb_image".
> > > A simple call like this should work: my $fb_image = 
> > > $element->get_value("fb_image"); $element SHOULD be fb_metadata 
> > > and this call should return the value in
> > that
> > > field but it doesn't.
> > > Any suggestions?
> > 
> > Have you created a story with an fb_metadata element and an fb_image
> value?
> > Do you have a template for your story element type the calls 
> > $burner->chain_next?
> > 
> > > This template is called from a utility template like so:
> > > % $m->comp('/util/fb_metadata.mc');
> > 
> > Why called by a utility template? And from what template it it called?
> > 
> > > They only way I've been able to access the fb_metadata is to 
> > > actually
> > pass
> > > it into the template call which really doesn't make sense because 
> > > I
> > should
> > > already be in the template for the element.
> > > 
> > > // This works but shouldn't be needed my $metadata = 
> > > $story->get_container('ew_metadata');  // Metadata
> > container
> > > that fb_metadata is in
> > > my $fb_metadata = $metadata->get_container("fb_metadata"); // Get 
> > > the fb_metadata container if ($fb_metadata) {
> > > $m->comp('/util/fb_metadata.mc', obj => $fb_metadata); // call 
> > > the template and pass in the fb_metadata object.
> > > }
> > > 
> > > Any help would be greatly appreciated.
> > 
> > What does $element->get_key_name give you? That will be the name of 
> > the current element.
> > 
> > Best,
> > 
> > David
> 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic