TYPO3 fluid menu condition for current page - menu

I'm using TYPO3 v. 8.7 and ext. vhs
Is it possible to make a condition that checks for current page? Have tried the code below but it does not work. I think it should then be possible to check for Current page
<v:page.menu expandAll="1" entryLevel="1" >
<f:for each="{menu}" as="menuPage" iteration="iteration">
<f:if condition="{menuPage.isCurrentPage}">
<f:then>is current page</f:then>
<f:else>is not current page</f:else>
</f:if>
</f:for>
</v:page.menu>

I don't know which version of EXT:VHS you are using, maybe an old one (as you wrote the deprecated v:page.menu instead of v:menu ).
You can discover all the options available for each item on the menu and their current value just using
<f:debug>{_all}</f:debug>
Like this:
<v:page.menu expandAll="1" entryLevel="1" >
<f:for each="{menu}" as="menuPage" iteration="iteration">
<f:debug>{_all}</f:debug>
<f:if condition="{menuPage.uid} == {data.uid}">
<f:then>is current page </f:then>
<f:else>is not current page</f:else>
</f:if>
</f:for>
</v:page.menu>
On version 6.0.0 (the one I am currently using) there are the boolean current and active so your code should be just:
<v:menu expandAll="1" entryLevel="1" >
<f:for each="{menu}" as="menuPage" iteration="iteration">
<f:if condition = "{menuPage.current}">
<f:then>is current page </f:then>
<f:else>is not current page</f:else>
</f:if>
</f:for>
</v:menu>
Plus, if you just need a different class for your "active" or "current" items, you can also use the v:menu arguments ´classActive´ and classCurrent
for example:
<v:menu expandAll="1" entryLevel="1" classCurrent="is-current" classActive="is-active">
<f:for each="{menu}" as="menuPage" iteration="iteration">
<li class="{menuPage.class}">
<f:link.page pageUid="{menuPage.uid}" title="{menuPage.linktext}">{menuPage.linktext}</f:link.page>
</li>
</f:for>
</v:menu>

I have temporarily resolved it as follows. But I don't think that's the nicest solution.
<v:page.menu expandAll="1" entryLevel="1" >
<f:for each="{menu}" as="menuPage" iteration="iteration">
<f:if condition="{menuPage.uid} == {data.uid}">
<f:then>is current page </f:then>
<f:else>is not current page</f:else>
</f:if>
</f:for>
</v:page.menu>

Related

How to click on Web check box using Excel VBA?

How do I check the table checkbox?
I tried clicking.
ie.Document.getElementsByClassName("x-grid3-hd-checker").Checked = True
<div class="x-grid3-hd-inner x-grid3-hd-checker x-grid3-hd-checker-on" unselectable="on" style="">
<a class="x-grid3-hd-btn" href="#"></a>
<div class="x-grid3-hd-checker"> </div>
<img class="x-grid3-sort-icon" src="/javascript/extjs/resources/images/default/s.gif">
</div>
I can't see a checkbox in the HTML code. But you use getElementsByClassName() in a wrong way for your case. getElementsByClassName() generates a node collection. If you need a specific node, you must get it by it's index in the node collection. First element has index 0.
Please note that the div tag with the CSS class class="x-grid3-hd-inner x-grid3-hd-checker x-grid3-hd-checker-on " is also included in the Node Collection, because a part of the class identifier is identical to "x-grid3-hd-checker ". [Edit: I'm not realy sure if the part must maybe stand at the begin of the identifier]
If you want to check this:
<div class="x-grid3-hd-checker"> </div>
Your code needs the second index of the node collection:
ie.Document.getElementsByClassName("x-grid3-hd-checker")(1).Checked = True
But if there are more tags with the class name "x-grid3-hd-checker" the above line don't work. I can't say anymore until you don't post more HTML and VBA code. The best would be a link to the site.

Prestashop 1.7 attribute groups - check stock and apply css to unavailable combination

Prestashop option to hide unavailable attributes on product page doesn't work when attribute groups are used, for example color and size (for clothing shops).
I need to keep showing all possible combinations, but grey out (or strikethrough) the combinations with no stock.
Like this:
I tried several things.
In Prestashop 1.6 the following piece of code worked to apply css class (.out-of-stock-float-left) to unavailable combinations:
{elseif $group.group_type == 'radio'}
<ul id="group_{$id_attribute_group}">
{foreach from=$group.attributes key=id_attribute item=group_attribute}
{if {$group.attributes_quantity[{$id_attribute|intval}]} > 1} <!-- product in stock -->
<li class="input-container float-left">
<input class="input-radio" type="radio" data-product-attribute="{$id_attribute_group}"
name="group[{$id_attribute_group}]"
value="{$id_attribute}"{if $group_attribute.selected} checked="checked"{/if}>
<span class="radio-label">{$group_attribute.name}</span>
</li>
{else} <!-- product out of stock -->
<li class="input-container out-of-stock-float-left">
<input class="input-radio" type="radio" data-product-attribute="{$id_attribute_group}"
name="group[{$id_attribute_group}]"
value="{$id_attribute}"{if $group_attribute.selected} checked="checked"{/if}>
<span class="radio-label">{$group_attribute.name}</span>
</li>
{/if}
{/foreach}
</ul>
{/if}
When changing combinations there is an ajax request. I don't know how to grey out combinations with no stock and make them not clickable.
Thanks

TYPO3 Fluid Viewhelper Content of First Subpage

I created a content to show the content of subpages.
<v:page.menu pageUid="{page.uid}" levels="2">
<f:for each="{menu}" as="item">
<v:content.render pageUid="{item.uid}" column="0"/>
</f:for>
</v:page.menu>
It works!
Is there a way to get only the content of the first subpage?
Use iterator in <f:for>:
<v:page.menu pageUid="{page.uid}" levels="2">
<f:for each="{menu}" as="item" iteration="iterator">
<f:if condition="{iterator.isFirst}">
<v:content.render pageUid="{item.uid}" column="0"/>
</f:if>
</f:for>
</v:page.menu>
https://docs.typo3.org/typo3cms/ExtbaseGuide/Fluid/ViewHelper/For.html#example-with-iterator-information

ExpressionEngine & Taxonomy 3 - How to split nodes into blocks of 5?

I am using ExpressionEngine 2.10.3 and also Taxonomy 3 plugin. I have the following code which, when run, returns the 15 nodes I have set up:
<div class="col-md-4">
{exp:taxonomy:nav tree_id="1" display_root="no" root_node_id="2"}
<li>
{node_title}
</li>
{/exp:taxonomy:nav}
</div>
What I would like to do is after every 5 entries, end the current <div> and start a new col-md-4. Usually, I would use {switch} and I have tried it like this:
<div class="col-md-4">
{exp:taxonomy:nav tree_id="1" display_root="no" root_node_id="2"}
<li>
{node_title}
</li>
{switch='||||</div><div class="col-md-4">'}
{/exp:taxonomy:nav}
</div>
But it doesn't work at all, instead it just prints out {switch='||||'}
Is there any way of doing what I'm trying to do?
If you're on 2.7.1 or greater and your taxonomy:nav has the nav_count variable, use the modulo operator. Instead of your {switch...} thing, put
{if nav_count % 5 == 1}
</div><div class="col-md-4">
{/if}
If you end on an modulo-5 count, though, you're going to have an empty div....

Sparkup Syntax for repeating more than just a single element?

Say I have this:
...
<li class='tab'>7</li>
<li class="tab">8</li>
...
...and I'd like to use Sparkup in my editor to add another say 6 tabs...so I run the sparkup command:
li.tab > a[href=#tab2-$]{$}*6
but it comes out all wrong,
<li class="tab">8</li>
<li class="tab">
1
2
3
...
</li>
My first thought was that my syntax should have been:
(li.tab > a[href=#tab2-$]{$})*6
But that did pretty much the same thing...except this time it didn't insert the second number:
<li class="tab">8</li>
<li class="tab">
$
$
$
...
</li>
Now the range problem (starting at 9 instead of 1) is just a minor annoyance, but what if I want it to repeat the li as well as the a tag?
And yes, before you go off about it, I am indeed aware that I could create all of this stuff just using a simple for loop; but that wasn't part of the question now was it?
You are almost there:
li.tab*6 > a[href=#tab2-$]{$}
You want to create 6 <li> so that's where you should put your multiplier.
No need to be defensive.

Resources