[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ic] The [component] tag


Zambra wrote:

Hello,

I've installed Interchange 5.2.0, and I'm trying to customize it (just on
the template side, I don't need additional or modified features). I'm
dissecting the template files for the Foundation store, but don't understand
what:

[component group=vertical]

does mean.

Although "component" doesn't seem to be explicitly documented in the docs, I
guess this tag calls the component file. But, what does the
"group"-parameter mean? Also I can't find any component called "vertical".

Thanks in advance for your help!

The [component] tag is closely related to the [control-set] and [control] tags. It is a bit confusing, in my opinion. I don't know if it's documented anywhere or not, so I figured out how to use it by reading the core code.

Basically, [control-set] lets you set up a group of arbitrary variable name/value pairs, which stick together as a single unit. In other words:
[control-set
   [group]vertical[/group]
   [option]some_option[/option]
[/control-set]

The above defines a particular set of control values; the set consists of an argument 'group' whose value is 'vertical', and an argument 'option' whose value is 'some_option'.

Subsequent calls to [control-set] sets up other sets of control values. This builds a stack of control values, in the order in which they're defined.

[control], on the other hand, is a way of fetching values out of that stack. Components in the catalog will make use of [control] to get these values. The syntax is:
[control <argument> <default>]

After defining the above [control-set], calling:
[control group]

would return 'vertical'.

While [control option] would return 'some_option', and [control pluto] wouldn't return anything (since 'pluto' wasn't defined in the [control-set]). However, [control pluto hades] would return 'hades', because you providing the [control] tag with a default value of 'hades' to use in the event that 'pluto' is empty.

This is just a rough explanation. Basically, you define the different value sets using [control-set]...[/control-set] first. Then, you reset the current control value set to the top of the stack with a [control reset=1]. Then, you can [control <argument_name>] to retrieve values from that set. You call [control] with no parameters at all to advance to the next set of control values in the stack.

So, with all of that explained somewhat, [component] basically functions as a wrapper for doing this stuff (from what I can see; I've never really used it).
[component group=vertical] is effectively the same as:
[control-set]
   [group]vertical[/group]
[/control-set],
followed by an include of the component definition for the component named in the current control space's "component" value. If that component definition has '[control group]' within it, it will be replaced with 'vertical'.

I hope this helps. It's a lengthy answer but the system isn't particularly easy to explain.

- Ethan

--
Ethan Rowe
End Point Corporation
suppressed
_______________________________________________
interchange-users mailing list
suppressed
http://www.icdevgroup.org/mailman/listinfo/interchange-users


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.