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

Mailing List Archive: Bricolage: users

one template, two elem. types

 

 

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


zdravko.balorda at siix

Mar 30, 2009, 7:06 AM

Post #1 of 5 (1069 views)
Permalink
one template, two elem. types

Hi,
I'd like to use same template on a fixed URI story
and a slug-ish URI story.
Is there a way?

Regards, Zdravko.


bret at pectopah

Mar 30, 2009, 7:09 AM

Post #2 of 5 (1004 views)
Permalink
Re: one template, two elem. types [In reply to]

You could use a utility template, and just pass it the story you want it
to render:

$m->comp('/util/double_use_template.mc', the_story => $story);

Hope this helps,

Bret

On Mon, 2009-03-30 at 16:06 +0200, Zdravko Balorda wrote:
> Hi,
> I'd like to use same template on a fixed URI story
> and a slug-ish URI story.
> Is there a way?
>
> Regards, Zdravko.
>
>
--
Bret Dawson
Producer
Pectopah Productions Inc.
(416) 895-7635
bret [at] pectopah
www.pectopah.com


david at kineticode

Mar 30, 2009, 8:21 AM

Post #3 of 5 (1006 views)
Permalink
Re: one template, two elem. types [In reply to]

On Mar 30, 2009, at 7:09 AM, Bret Dawson wrote:

> You could use a utility template, and just pass it the story you
> want it
> to render:
>
> $m->comp('/util/double_use_template.mc', the_story => $story);

You can also just have the one template inherit from the other:

<%flags>
inherit => '/other_template.mc'
</%flags>

Best,

David


bret at pectopah

Mar 31, 2009, 1:03 PM

Post #4 of 5 (984 views)
Permalink
Re: one template, two elem. types [In reply to]

Hm. I just tried this without success.

I put the <%flags> block in template B, pointing to template A. But
previewing a story containing a type B subelement now shows no output
for that subelement. Element types A and B have the same structure.

Any ideas what I might be missing? (It's not urgent, I'm just curious.)


Cheers,

Bret






On Mon, 2009-03-30 at 08:21 -0700, David E. Wheeler wrote:
> <%flags>
> inherit => '/other_template.mc'
> </%flags>
--
Bret Dawson
Producer
Pectopah Productions Inc.
(416) 895-7635
bret [at] pectopah
www.pectopah.com


david at kineticode

Mar 31, 2009, 2:49 PM

Post #5 of 5 (1001 views)
Permalink
Re: one template, two elem. types [In reply to]

On Mar 31, 2009, at 1:03 PM, Bret Dawson wrote:

> Hm. I just tried this without success.
>
> I put the <%flags> block in template B, pointing to template A. But
> previewing a story containing a type B subelement now shows no output
> for that subelement. Element types A and B have the same structure.
>
> Any ideas what I might be missing? (It's not urgent, I'm just
> curious.)

I ran into this the other day; IIRC, it happened to me because I
inherited from a template that did not itself inherit from /
autohandler, so the autohandler was never called. Or something like
that.

No, wait, the stuff from the autohandler was there, just not the stuff
from the story element template. Hrmm…ah, yes, the autohandler was
calling display_element() on a different element. IOW, I had
foo_page.mc inherit from page.mc, but the autohandler was calling
display_element() only for page elements, not for foo_page.mc
elements. So be sure that your handlers are still calling out to the
template that's inheriting to some other template.

HTH,

Daivd

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.