KK wrote: Hi and welcome :)

Please try the following:
Code: Select all
<cms:set current_folder_name = k_folder_name />
<ul>
<cms:folders masterpage='news.php' orderby='title' >
    <li class="<cms:if current_folder_name=k_folder_name>active</cms:if>"><a href="<cms:show k_folder_link />">
    <span> <cms:show k_folder_title /></span></a></li>
</cms:folders>
</ul>

To explain the code: The 'folder-view' sets a variable named 'k_folder_name' that contains the name of the current folder. We save this in another variable named 'current_folder_name' and then compare it with the names of the folders as they are iterated using cms:folders tag (incidentally, the name of the variable set by cms:folders tag is also 'k_folder_name' which explains why we had to save the first one in another variable).

Hope this helps.


@KK Sir,
I tried this. But the active class is not set.
If I try to set the "current_folder_name" outside the <cms:folders> then the value of "current_folder_name" is blank.
Then, if I set the "current_folder_name" inside the <cms:folders> it outputs all folders.

My code for generating the folders is:
Code: Select all
<cms:folders masterpage="product.php" hierarchical="1" order="desc" depth="1">
    <li class="dropdown <cms:if current_folder_name=k_folder_name>active</cms:if>">
        <a href="<cms:show k_folder_link />" class="dropdown-toggle" data-toggle="dropdown">
       <cms:show k_folder_title /> <b class="caret"></b>
        </a>
        <ul class="dropdown-menu" role="menu">
            <li>
                <a href="<cms:show k_folder_link />">View ALL</a>
            </li>
            <li role="separator" class="divider"></li>
            <cms:folders masterpage="product.php" hierarchical="1" childof=k_folder_name order="asc" depth="1">
                <li>
                    <a href="<cms:show k_folder_link />"><cms:show k_folder_title /></a>
           </li>
      <cms:if "<cms:not k_last_child />" >
      <li role="separator" class="divider"></li>
      </cms:if>
            </cms:folders>
        </ul>
    </li>
</cms:folders>


The above code is being used to generate a menu structure for the site at https://www.thedashami.com/demo/.

Regards,
GenXCoders