hey, all.
i am working on a project that needs to do some nested control stuff.
Site Tree
+ product holder (ProductHolderType)
-Product A (ProductPage Type)
-Product B (ProductPage Type)
-term and condition (Page Type)
The outcome i wanna achieve is on my ProductHolder, ProductA,B and Term and condition Page show side bar for secondary-level navigation.
i created a sideNav.ss in the include file.
<% control Menu(2) %>
<% if LinkOrSection = section %>
<% if Children %>
<h4>
$MenuTitle.XML
</h4>
<ul class="sub">
<li>
<ul class="roundWhite">
<% control Children %>
<li><a href="$Link" title="Go to the $Title.XML page" class="$LinkingMode levelb">$MenuTitle.XML</a></li>
<% end_control %>
</ul>
</li>
</ul>
<% end_if %>
<% end_if %>
</li>
<% end_control %>
The ProductHolder, and ProductPage type works fine.
Since i have already got lots of different page types, thought it will be neasty for creating a new Page type for using the side bar there.
So i wanna achieve If the normal Page under the ProductHolder -> show sidebar. otherwise dont show.
i did something like <% control Parent %>
<% if ClassName = ProductHolder %>
<% include SideNav %>
<% end_if %>
<% end_control %>
i dont why the code in the SideNav.ss cannot be executed. maybe they nested control there?!
Another alternative way:
try to use php code logic to do the if statement and renderwith the template in the include file.
was doing someting like:
public function includeSideNav(){
Debug::show($this->Parent()->ClassName);
if($this->Parent()->ClassName=="ProductHolder")
{
//display the outcomes
return Director::$this->renderWith("Includes/SideNav.ss");
}
}
But seems doesnt work. error message[stat failed for Includes/SideNav.ss]
Anyone can help :)
Thanks in advanced