<xen:container var="$var">Some string value</xen:container>
<xf:page option="$var" value="$anyValueType" />
<xf:page option="$var">Some string value</xf:page>
That will have never worked (wouldn't have worked in XF1, either).
In XF1 the solution was:
Code:<xen:container var="$var">Some string value</xen:container>
In XF2 the equivalent is:
orCode:<xf:page option="$var" value="$anyValueType" />
Code:<xf:page option="$var">Some string value</xf:page>
<!doctype html>
<xf:include template="conditionals" />
{{ dump($someVariable) }}
<xf:set var="$someVariable" value="1" />
<xf:set> would set the variable in the current content or container template and only be accessible in the content or container template it was set in.<xf:page> would set the variable in the current content template and make it available in the container template.Indeed looks like I misunderstood the original message.Just to be clear, we're including a template from within PAGE_CONTAINER (rather than in the content template) that contains several conditionals that we use a lot, it's working fine in xf1 but doesn't seem to be working in xf2
As an example, in PAGE_CONTAINER just below the doctype line:
Code:<!doctype html> <xf:include template="conditionals" /> {{ dump($someVariable) }}
and within "uix_conditionals" we'd have:
Code:<xf:set var="$someVariable" value="1" />
We use this for things like welcome block, extended footer etc just so we don't have to duplicate conditionals, and we split it into a separate template to keep the PAGE_CONTAINER template cleaner and easier to merge down the line
renderTemplate() method in the templater).<xf:include template="uix_conditionals" />
<xf:set var="$uix_conditionals" value="{{ $xf.app.templater->pageParams.uix_conditionals }}" />
...
<xf:macro template="uix_macros" name="uix_extended_footer" arg-uix_conditionals="{$uix_conditionals}" />
<xf:page option="uix_conditionals.foo" value="1" />
<xf:page option="uix_conditionals.bar" value="0" />
<xf:macro name="uix_extended_footer" arg-uix_conditionals="!">
<xf:if is="$uix_conditionals.foo">whatever</xf:if>
</xf:macro>
(You might want to consider if there's some alternative approaches you can take in the mean time).
Does this work?
PAGE_CONTAINER
Code:<xf:include template="uix_conditionals" /> ... <xf:macro template="uix_macros" name="uix_extended_footer" arg-uix_conditionals="{$uix_conditionals}" />
uix_conditionals
Code:<xf:page option="uix_conditionals.foo" value="1" /> <xf:page option="uix_conditionals.bar" value="0" />
uix_macros
Code:<xf:macro name="uix_extnded_footer" arg-uix_conditionals="!"> <xf:if is="$uix_conditionals.foo">whatever</xf:if> </xf:macro>
xf:page only works in the content templateCode:<xf:page option="$var" value="$anyValueType" />
<xf:page option="var" value="{$anyValueType}" />
$var available in the page container.Save my lifeTook me a while to figure that out. In fact, the correct syntax is:
Then you'll haveCode:<xf:page option="var" value="{$anyValueType}" />$varavailable in the page container.
We use essential cookies to make this site work, and optional cookies to enhance your experience.