Hello,

Is it possible to use a variable value for metal:use-macro. I have a site that is using page templates and I have implemented a scheme that can have different layouts. Each layout may have different skins. Layouts allow me to have multiple site designs with the same basic elements and the same content, but I can position elements such as the logo or menus in different places. Layouts also allow me to use different methods for defining a layout, i.e. tables for older browsers and layers for newer browsers. Each layer may have different skins. A skin defines which graphical elements and css file to use with a certain layout.

 

Ideally the layout and the skin for the layout would be changeable by me or the visitor to the site. The functionality I want to have is to support older browsers with a basic layout and support new browsers with a more advanced layout, or having a layout geared to those with bad eyesight, or allowing those with logins to choose their preferred layout and skin, or to change the layout or skin of the entire site for basic design updates by changing a variable.

 

To start off with I just have two properties on the root folder, layout and skin. I have two scripts, get_skin and get_layout. Calling each returns the skin or layout using the variables in the layout and skin properties. In the future I may also check a session variable or perhaps a querystring parameter for these values. Each page template in the site currently begins with a metal:use statement and so far the value is a static string. What I want to accomplish is to insert a variable for the value. Everything I have tried thus far has failed to work. Can you use statements in the metal directives that you can use in the tal directives? Does metal except string: and python: combinations and how could I best insert a dynamic value for this directive given a layout variable. Different pages use different templates within the layout. I have a frontpage template, sub_page template and sub_page_index template.

 

<html metal:use-macro=”container/layouts/default/frontpage/macros/standard”>

<div metal:fill-slot=”content”></div>

</html>

 

The value for metal shown above consists of the layout variable portion ‘container/layouts/default’ and the static layout template portion ‘/frontpage/macros/standard’. How could I set the value of the metal:use-macro directive to a string value containing the layout variable and a static string portion as show above?

 

Thanks,

David