Re: Modify attribute based on id
espen <[email protected]>
| Newsgroups | gmane.comp.web.zope.plone.user |
|---|---|
| Message-ID | <[email protected]> |
21. aug. 2014 kl. 08:30 skrev ctheobald [via Plone] <ml-node+s293351n7572352h65-PKuAHvtXa09l57MIdRCFDg@public.gmane.org>:
> It seems a bit overkill to have a new template or a custom content type for my research page. I would think that a simple rule based on path (if-path="research/") in the rules.xml file would be sufficient to add a class="two-column" to an element or to apply an additional layer of div="two-column" to the element.
>
> I am very new to plone and may not be getting some basic concepts, but I understand the concept of theme+content => presentation. I am just not understanding how it is not possible to add class="two-column" to an element based on a condition, say, if-path="research/"
>
(as stated in last mail)
Is it not much easier to just place whatever css you need on
body.section-research #content {
webkit-column-count: 2; /* Chrome, Safari, Opera */
-moz-column-count: 2; /* Firefox */
column-count: 2;
}
(two columns on IE might not work, though
Espen
>
> Chuck
>
>
> On 08/20/2014 01:19 AM, espen wrote:
>>
>> 20. aug. 2014 kl. 02:03 skrev ctheobald [via Plone] <[hidden email]>:
>>
>>> I would like to selectively apply a css class definition to an element
>>> based on the path. For instance, I have a Research page that I would
>>> like formatted in two columns rather than one. In this case, then, I
>>> want to apply/add class="two-column" to the content element <div
>>> id="content-core">.
>>
>> If your research page has its own template or it is a custom content type, I would rather use that…
>>
>> maybe:
>> .portaltype-researchpage #content {
>> somecss: here;
>> }
>>
>> body.section-research #content {
>> should: worktoo;
>> }
>>
>> If you really want to use rulest, why not just use a custom template:
>> <theme href=«columns.html" css:if-content=«body.section-research" />
>>
>> and then just wrap the content div in another (span)?
>> (this will make it possible to do other adjustments, too)
>>
>> Espen
>>
>>
>>> I have found leads toward an xsl solution, but have not gotten it to work:
>>>
>>> http://docs.plone.org/external/diazo/docs/recipes/adding-an-attribute/index.html
>>>
>>> I've modified the given code as follows, but this severely breaks the
>>> theming:
>>>
>>> <xsl:template match="div#content-core">
>>> <xsl:copy>
>>> <xsl:attribute name="class">two-column</xsl:attribute>
>>> <xsl:copy-of select="@*" />
>>> <xsl:apply-templates />
>>> </xsl:copy>
>>> </xsl:template>
>>>
>>> I've also tried variations of the following without success:
>>>
>>> <replace css:content="div#content-core">
>>> <class="two-column"></class>
>>> </replace>
>>> <copy attributes="class" css:content="#content-core"
>>> if-path="research" theme='//*[@class="two-column"]' />
>>>
>>> Thank you,
>>>
>>> --
>>> Chuck Theobald
>>> System Administrator
>>> The Robert and Beverly Lewis Center for Neuroimaging
>>> University of Oregon
>>> P: 541-346-0343
>>> F: 541-346-0345
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Slashdot TV.
>>> Video for Nerds. Stuff that matters.
>>> http://tv.slashdot.org/
>>> _______________________________________________
>>> Plone-Users mailing list
>>> <a href="x-msg://21/user/SendEmail.jtp?type=node&node=7572342&i=0" target="_top" rel="nofollow" link="external">[hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/plone-users
>>>
>>>
>>> If you reply to this email, your message will be added to the discussion below:
>>> http://plone.293351.n2.nabble.com/Modify-attribute-based-on-id-tp7572342.html
>>> To start a new topic under General Questions, email [hidden email]
>>> To unsubscribe from Plone, click here.
>>> NAML
>>
>>
>> View this message in context: Re: Modify attribute based on id
>> Sent from the General Questions mailing list archive at Nabble.com.
>>
>>
>> ------------------------------------------------------------------------------
>> Slashdot TV.
>> Video for Nerds. Stuff that matters.
>> http://tv.slashdot.org/
>>
>>
>> _______________________________________________
>> Plone-Users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/plone-users
>
>
> --
> Chuck Theobald
> System Administrator
> The Robert and Beverly Lewis Center for Neuroimaging
> University of Oregon
> P: 541-346-0343
> F: 541-346-0345
>
> ------------------------------------------------------------------------------
> Slashdot TV.
> Video for Nerds. Stuff that matters.
> http://tv.slashdot.org/
> _______________________________________________
> Plone-Users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/plone-users
>
>
> If you reply to this email, your message will be added to the discussion below:
> http://plone.293351.n2.nabble.com/Modify-attribute-based-on-id-tp7572342p7572352.html
> To start a new topic under General Questions, email ml-node+s293351n293352h65-PKuAHvtXa09l57MIdRCFDg@public.gmane.org
> To unsubscribe from Plone, click here.
> NAML
--
View this message in context: http://plone.293351.n2.nabble.com/Modify-attribute-based-on-id-tp7572342p7572353.html
Sent from the General Questions mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds. Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Plone-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/plone-users