Christian,
Thanks for your response. That's pretty much what I ended up doing. A
simplified version of my markup looks like this:
<div class="left_col">
[*include extrasArea]
<div>
<div class="content">
...
</div>
<div class="right_col">
[*include extrasArea]
<div>
That yields output like this:
<div class="left_col">
<div id="extras-1">
<div id="extras-2">
<div>
<div class="content">
...
</div>
<div class="right_col">
<div id="extras-1">
<div id="extras-2">
<div>
I then the use CSS rule display:none to hide an extras area in each of the
columns.
Of course, that is not an ideal solution, since it still generates the
markup for the extras-n that I don't want to see. I'm trying to figure out
how to set a parameter that can then be access by extrasrAea.ftl so I can
conditionally build only the extrasArea I want to appear. Something like
this:
<div class="left_col">
[#assign col=1]
[*include extrasArea]
<div>
to yield only...
<div class="left_col">
<div id="extras-1">
<div>
However, a drawback to doing that is that I am editing the extrasArea.ftl
which will make thing more difficult to maintain as newer version of the
STK are released. Is there a preferred way of handling a situation like
that?
Jim
From:
Christian Ringele <[email protected]>
To:
"Magnolia User-List" <[email protected]>
Date:
07/30/2009 04:36 AM
Subject:
Re: [magnolia-user] Extra extraArea
Sent by:
<[email protected]>
Hi Jim,
Sorry for this late response, I hope it still wil be some help.
I will paste at the bottom a 'long' explanation I wrote to a user
(Denis) in this mailing list.
I think it has some relevance to your question and can be of some help.
Probably you read it first before the following answer to you problem:
You can configure dynamically the extrasArea to multiple areas in the
site configuration:
Templating Kit -> Site definition ->
default.templates.prototype.extrasArea -> proberty 'columns'
With dynamically I mean, that just be defining here a number-value, as
many extrasAreas are created e.g. extras1, extras2, extras3...
By default they are places in a 'parent-div' 'extras':
----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------
[attachment "Picture 3.png" deleted by Jim Hanson/MCG]
This is all what has been done in the 'stkSectionWithTwoExtras'
template, just configuring the value 'columns'.
No change of the main.ftl template was needed to this point (or in any
other template).
Now your goal is to place one extras right and one left of the main
Area.
So i guess the parent-div 'extras' is a problem, beeing on the same
level as the div main (mainArea).
I guess is should have the extras1, extras2 div on the same level with
the main-div (no extras-div at all)
There is a very easy solution for that:
- Use a own main.ftl template (as you already do).
- Just remove the 'extras' div from it:
Change from
[#if def.extrasArea.enabled]
<div id="extras">
[#include def.extrasArea.template]
</div><!-- end extras -->
[/#if]
to
[#if def.extrasArea.enabled]
[#include def.extrasArea.template]
[/#if]
Thats it.
Now the extras1 or extras2 div can be placed by css without a problem
left or right of the main-div.
Don't get confused on the fact, that css can place the div's in
different order on the page, than the in the order their html is
rendered.
For example you might want, that the extas on the left of main is
placed on small screens below the main and extras2.
I hope this 'solves' your problem.
greeting
Christian
On Jul 27, 2009, at 20:10 , [email protected] wrote:
> Greetings,
>
> I'm new to Magnolia and this is my first post. I'm using the EE
> version of Magnolia. I apologize if my question is simple-minded.
>
> What I've been working through is creating my own main template to
> structure a page. I would like two distinct extraAreas, one for the
> right and one for the left column. I have not had luck doing this so
> far. It seems that two extraAreas can be set by the column number of
> the extraAreas (at various places in the configuration). The code I
> put in the calling template is: [#include def.extrasArea.template].
> That obviously is wrong because I never differentiate the data nodes
> between two distinct extraAreas
>
> I see there is a stkSectionWithTwoExtras in the STK. However, I
> don't know how to access it. Any suggestions, or nudges in the right
> direction, will be appreciated
>
> Jim
Mail/Conversation with Denis:
Hi Dennis,
No problem at all!
Yes, its hard to write about these things that the meaning is clear of
a question (or answer ;) ).
I write below in your text.
On Jul 7, 2009, at 10:32 , Dennis Buenzel wrote:
>
> Thank you Christian, I got this working, but it's still not exactly
> what I meant:
> I want to keep the extras function enabled on _some_ section pages
> and disable it on some others which also have the type section.
Lets say we talk about two different template names, so we can speak
of the same:
- 'section no extras'
- 'section with extras'
>
> Is there a way to put this into practice or do I need to make real
> "physical" copies of each template so that I'll have 3-5 versions of
> each template?
> It's not a problem but I was just wondering if you did sth. else
Here i think i was not clear about 'copies':
Because you can configure these values on 'template configuration
level' you can use the same physical template (freemaarker ftl
template, in this case main.ftl) for all of these configurations.
You don't need to copy the physical template at all, it reacts on it.
(This you can see best on the teaser paragraphs, all teaser
configurations use the same ftl template, just their config differ).
So concrete you need to copy the section template CONFIGURATION. Both
can/must keep the category 'section' (this is what makes them a
section).
Now you have two section templates in the configuration, one for
'section no extras' and one 'section with extras'.
In one you disable extras, in the other not.
You wrote:
'I'll have 3-5 versions of each template?'
I would approach it like this:
- Fist you define a general site wide behaviour: extras -> yes,
platform -> no, promos -> not, etc
Now you have defined the behaviour which counts for every template
in your site.
The standart (not copied) section template has as defined site wide
extras or not.
- Now gather the 'exceptions:
I need 'one section without extras', 'one article with promos' and
'one section without' header.
Now out of this you can say -> each exception of the standart site
areas behaviour needs one copy of it's original configuration.
Like this I think you will not need of each template 3-5 copies, just
for the exceptions.
Usually most pages/templates have the same area configurations and
only a few exceptions use different areas.
And you don't have to change anything in a physical template
- add the new template config's to the availability in the site
configuration:
site definitions -> default -> templates -> availability -> templates
without this they will not appear on the dropdown as choosable
templates.
- Just a tipp for CSS:
If these two section pages should look different in css, just define
a different bodyID directly on template config level.
Like this you have wto sections (category is section), but they
behave different and even look different if needed.
But no change was needed at all on tempting itself (in any
freemarker).
>
> As you said here:
> "The site wide definition can be overwritten in any template.
> That is what you have seen in demo-features -> section variations.
> Each template you see there is a copy of the original section
> template.
> And in each copy i activated/deactivated a different area, overwriting
> the site wide definition."
>
> This still seems to be another method to me:
>
> If those are copies of the original template, why am I not able to
> select them for other pages? Or did I still get something wrong?
> I noticed, that those templates have the title e.g. "Section
> template with no extras and no Promos", but if I activate the
> dropdown once for the examples from "section variations" the "with
> no extras and no Promos" text disappears and so the template
> variation does.
This is due to this point written above:
- add the new template config's to the availability in the site
configuration:
site definitions -> default -> templates -> availability -> templates
without this they will not appear on the dropdown as choosable
templates.
Because it is not defined in 'available templates', they disappear
from the dropdown if not defined in 'available templates'.
You can say, this is a bit confusing. Probably we should add them to
the available templates.
> I hope this is not too confusing and you can understand what I am
> trying to say
Same here :)
>
> Thanks for your help and sorry for me being so slow on the uptake :)
np
Cheers
Christian
>
> Greetings
> Dennis
>
>
> -----Ursprüngliche Nachricht-----
> Von: [email protected] [
mailto:[email protected]
> ] Im Auftrag von Christian Ringele
> Gesendet: Montag, 6. Juli 2009 16:43
> An: Magnolia User-List
> Betreff: Re: AW: [magnolia-user] Need help with STK
>
>
> Hi Dennis,
>
> There are two ways to enable extras (extraArea).
> You an say that this approach counts for all areas available in STK
> (except mainArea, main hast to be there):
> - extrasArea, promosArea, platformArea, baseArea
>
> The two possibilities of enabling/disabling areas like extras are
> site-
> wise or template-wise.
> These are two approaches for providing all different variation
> possibilities in one site.
> As Francois writes:
> Site Definitions > default > templates > prototype > extrasArea.
> This is the site wise approach means -> on all templates, not
> overwriting this value, extras is disables/enabled
>
> The site wide definition can be overwritten in any template.
> That is what you have seen in demo-features -> section variations.
> Each template you see there is a copy of the original section
> template.
> And in each copy i activated/deactivated a different area, overwriting
> the site wide definition.
>
> Generally all values in the site-wide-areas definition can be
> overwritten on template level, not only the enabled option.
> Like this you can overwrite for example the 'paragraphs' values ->
> which paragraphs are provided in the new bar on template level.
> This means that you create on template level the exact same property
> with a different value -> overwrites the site value for this template.
>
> Now concrete on disabling the extrasArea on template level:
> config -> modules -> standard-templating-kit -> templates ->
> stkSection (or the template you want to change) -> generate
> contentNode 'extrasArea' -> generate property 'enabled' value 'false'
>
> this overwrites the general site configuration 'extrasArea->enable'
> which counts for all templates.
>
> I hope this explanation is understandable :)
>
> Cheers
> Christian
>> Hi there,
>> I'm playing around with Magnolia a little and I just can't find out
>> how to disable the "extras" and "promos" sections. There are
>> examples for this functions at the "demo-features" -> "section-
>> variations" site but just can't find out how to apply those settings
>> to specific categories on my own site -.-
>>
>> thanks
>> sYned
>
----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------