I am working on a silverstripe subdomains' issue, someone else did the code, so any help would be appreciated.
There is a "About Us" nav bar on the main website eg www.mainwebsite.com, and we would like the "About Us" to disappear for any subdomains eg subdomain.mainwebsite.com.
I can see from the Silverstripe backend, there is a 'Hide in Subdomains' function, and I ticked it. However, the "About Us" link disappears for some time and it comes back at other tomes on both main site and subdomains.
Can anybody point me to the right direction how can I fix this problem? I can copy any code here if you need. Please help.
Thanks heaps, S:)
add comments, I have found this code in my page.php in my site - code folder if it is useful
function ShowMenuInSubdomain()
{
$host = explode('.',$_SERVER['HTTP_HOST']);
$subdomain = $host[0];
if($subdomain != 'www' && $this->HideInSubdomains) {
return true;
}
}
add comments, here is navigation part in Page.ss in the theme - templates folder I am using
<div id="Header">
<div id="HeaderWrapper">
<div id="LogoWrapper"><a href="{$BaseHref}">$GetSubDomainHeaderImage</a></div>
<div id="Navigation">
<% cached 'Navigation', Aggregate(Page).Max(LastEdited) %>
<% include Navigation %>
<% end_cached %>
</div>
</div>
</div>
add comments, here is what my navigation.ss in the templates - includes folder looks like
<ul>
<% control Menu(1) %>
<% if ShowMenuInSubdomain %>
<% else %>
<li <% if Children %>class="hasChildren"<% end_if %>>
<a href="$Link" title="$Title.XML" class="$LinkingMode">$MenuTitle.XML <% if ShowMenuInSubdomain %>0<% end_if %></a>
<% if Children %>
<ul>
<% control Children %>
<li <% if Children %>class="hasChildren"<% end_if %>>
<a href="$Link" title="$Title.XML" class="$LinkingMode">$MenuTitle.XML</a>
<% if Children %>
<ul>
<% control Children %>
<ul class="thridUL{$Pos}">
<% if DisableLink %>
<li>
<span class="$LinkingMode thirdLevelTitle lookLikeALink">$MenuTitle.XML</span>
</li>
<% else_if ShowLabelInMenu==0 %>
<li>
<a href="$Link" title="$Title.XML" class="$LinkingMode thirdLevelTitle">$MenuTitle.XML</a>
</li>
<% end_if %>
<% if Children %>
<% control Children %>
<li>
<a href="$Link" title="$Title.XML" class="$LinkingMode">$MenuTitle.XML</a>
<% if Summary %>
<span class="menuSummary">
$Summary
<span class="menuSummaryThumb">$Thumbnail.PaddedImage(160, 160)</span>
</span>
<% end_if %>
</li>
<% end_control %>
<% end_if %>
</ul>
<div class="clear"> </div>
<% end_control %>
</ul>
<% end_if %>
</li>
<% end_control %>
</ul>
<% end_if %>
</li>
<% end_if %>
<% end_control %>
<li id="calculatorWrapper">
<a id="Calculator" href="$distanceCalculator.Link" rel="shadowbox;height=800;width=1000"><span>Journey Planner</span></a>
</li> </ul>
Sorry it is a bit long but any help is appreciated. Thanks.
Hi everyone, it seems to be working now when I deleted <% cached 'Navigation', Aggregate(Page).Max(LastEdited) %> <% end_cached %> in page.ss. Can someone please kindly explain what was this line for or the meaning of it? Thanks.