fss
April 29, 2019, 3:11pm
1
Hi!
I am trying to theme Plone following https://training.plone.org/5/theming/ttw-advanced-2.html
After creating a new theme that inherits from Barceloneta, I am getting the following error after reloading the home page of the site:
runtime error, element 'if' [148:0]
Variable 'footer_portlets_count' has not been declared. [0:0]
Undefined variable [0:0]
The rules xml displayed after the above three lines that include the string footer_portlets_count are the following:
<xsl:variable name="footer_portlets_count" select="count($footer_portlets)"/>
after "Footer" section
and
<xsl:if test="$footer_portlets_count=1">col-md-12</xsl:if>
<xsl:if test="$footer_portlets_count=2">col-md-6</xsl:if>
<xsl:if test="$footer_portlets_count=3">col-md-4</xsl:if>
<xsl:if test="$footer_portlets_count=4">col-md-3</xsl:if>
<xsl:if test="$footer_portlets_count>4">col-md-4</xsl:if>
after "Move all other footer portlets into doormat area." section
I think all these come from Barceloneta.
Any ideas?
Thanks.
Filipe
1letter
(Jan)
April 30, 2019, 6:42am
2
I use the following for the replacement:
<!-- Central column with Right Portlets if available -->
<replace css:theme=".content-container" method="raw">
<xsl:variable name="central">
<xsl:if test="//aside[@id='portal-column-two']">col-md-9</xsl:if>
<xsl:if test="not(//aside[@id='portal-column-two'])">col-md-12</xsl:if>
</xsl:variable>
<xsl:variable name="right">
<xsl:if test="//aside[@id='portal-column-two']">col-md-3</xsl:if>
<xsl:if test="not(//aside[@id='portal-column-two'])">col-md-6</xsl:if>
</xsl:variable>
<div class="container content-container">
<div class="row">
<!-- Main Content -->
<div class="{$central}">
<!--- ..... -->
</div>
<!-- /Main Content -->
<!-- Right Slot -->
<div class="{$right}">
<!--- ..... -->
</div>
<!-- /Right Slot -->
</div>
</div>
</replace>
espenmn
(Espen)
April 30, 2019, 9:25am
3
I have never seen the 'count'… is it documented somewhere ?
What happens if you declare the variable as:
<xsl:variable name="footer_portlets_count">3</xsl:variable>
Completely unrelated, but you could consider using CSS flex or CSS grid and do it all with CSS (that is what I do)
petschki
(Peter Mathis)
April 30, 2019, 12:54pm
4
If i see correctly the $footer_portlets
variable is missing .... see the rules.xml on barceloneta master here https://github.com/plone/plonetheme.barceloneta/blob/master/plonetheme/barceloneta/theme/rules.xml#L104-L175
mtrebron
(Norbert )
June 28, 2019, 11:55am
5
I just ran into this issue and solved it as follows:
replace the filesystem barceloneta theme with a TTW version
in the ttw version, find rules.xml
and cut out the section marked with <!-- Footer -->
in lines 104-107
paste the two xsl variable definitions footer_portlets
and footer_portlets_count
below the line <replace css:theme-children="#portal-footer .doormat">
near line 126
rename index.html
in your custom theme to theme-index.html
copy index.html
from barceloneta to index.html
in your custom theme
use the following rules.xml
<?xml version="1.0" encoding="UTF-8"?>
<rules xmlns="http://namespaces.plone.org/diazo"
xmlns:css="http://namespaces.plone.org/diazo/css"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xi="http://www.w3.org/2001/XInclude">
<rules css:if-content="body:not(.userrole-anonymous)">
<!-- Import Barceloneta rules -->
<xi:include href="++theme++barceloneta/rules.xml"
/>
<after css:theme-children="head">
<link rel="stylesheet"
href="/++theme++barceloneta/less/barceloneta-compiled.css"
/>
</after>
</rules>
<rules css:if-content="body.userrole-anonymous">
<theme href="theme-index.html"
/>
<!-- your customizations go here -->
</rules>
</rules>
Note: on Plone 5.2 RC4 you will run into this issue when overriding barceloneta: https://github.com/plone/plone.app.theming/issues/160
balavec
(Robert Kuzma)
November 1, 2019, 6:32pm
6
I was trying to do something similar and got the same error by doing:
<rules css:if-not-content="body.viewpermission-view, body.viewpermission-none">
<xi:include href="++theme++barceloneta/backend.xml" />
</rules>
<rules css:if-content="body.viewpermission-view, body.viewpermission-none">
...
</rules>
Still exploring why this is an error.
The first part actually even doesn't matter. Get the error only by wrapping the main xml with following:
<rules css:if-content="body.viewpermission-view, body.viewpermission-none">
...
</rules>
petri
(Petri Savolainen)
February 23, 2020, 7:58pm
7
Just ran into the same thing on 5.2. The included barceloneta rules.xml seems to try & set the footer_portlets_count
like this:
<xsl:variable name="footer_portlets" select="//footer[@id='portal-footer-wrapper']//div[@class='portletWrapper']/*[not(contains(@id,'portal-colophon')) and not(contains(@id,'portal-footer-signature')) and not(contains(@class,'portletActions'))]"></xsl:variable>
<xsl:variable name="footer_portlets_count" select="count($footer_portlets)"></xsl:variable>
This of course works on barceloneta itself. I have no idea why it fails on a custom theme that derives from it, changing nothing: My custom TTW theme consists of nothing more than rules.xml importing barceloneta rules, and index.html that's a verbatim copy of the barceloneta one.
yurj
(Yuri)
April 20, 2021, 10:20am
8
This is still wrong, maybe the fix is to include
<!-- Footer -->
<xsl:variable name="footer_portlets" select="//footer[@id='portal-footer-wrapper']//div[@class='portletWrapper']/*[not(contains(@id,'portal-colophon')) and not(contains(@id,'portal-footer-signature')) and not(contains(@class,'portletActions'))]"></xsl:variable>
<xsl:variable name="footer_portlets_count" select="count($footer_portlets)"></xsl:variable>
just before
</rules>
?
thet
(Johannes Raggam)
March 4, 2023, 5:28pm
9
2 Likes