Re: Modify attribute based on id

Chuck Theobald <[email protected]>
Newsgroups gmane.comp.web.zope.plone.user
Message-ID <[email protected]>
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/"

Chuck


On 08/20/2014 01:19 AM, espen wrote:
>
> 20. aug. 2014 kl. 02:03 skrev ctheobald [via Plone] <[hidden email] 
> </user/SendEmail.jtp?type=node&node=7572351&i=0>>:
>
>> 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&amp;node=7572342&amp;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] 
>> </user/SendEmail.jtp?type=node&node=7572351&i=1>
>> To unsubscribe from Plone, click here.
>> NAML 
>> <http://plone.293351.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> 
>>
>
>
> ------------------------------------------------------------------------
> View this message in context: Re: Modify attribute based on id 
> <http://plone.293351.n2.nabble.com/Modify-attribute-based-on-id-tp7572342p7572351.html>
> Sent from the General Questions mailing list archive 
> <http://plone.293351.n2.nabble.com/General-Questions-f293352.html> 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


-- 
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/plone-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.