My menu tricks -- multiple domains setups -- Blogs

Do something cool with CMS? Show us ...
This board is for 'Answers', and the discussion of answers... Not for questions.
Post Reply
JeremyBASS

My menu tricks -- multiple domains setups -- Blogs

Post by JeremyBASS »

So I have a few posts about how to use one install for many domains here is another of many tricks I use...

so this is a menu

{cms_module module='menumanager' template='Site menu' excludeprefix='test_area,staff-content'}

the template

Code: Select all

<div style="padding:10px;">{if $count > 0}
<ul  style='list-style:none;'>
{foreach from=$nodelist item=node}
{if $node->depth > $node->prevdepth}
{repeat string="<ul style='vertical-align:bottom;list-style:none; color:#000; padding-left:10px;'>" times=$node->depth-$node->prevdepth}
{elseif $node->depth < $node->prevdepth}
{repeat string="</li></ul>" times=$node->prevdepth-$node->depth}
</li>
{elseif $node->index > 0}</li>
{/if}
{* remove each site's root page alias from their respective 'home pages' and children *}
{assign var=domain value=$smarty.server.SERVER_NAME|replace:'www.':''|replace:'.':''|replace:'-':''|replace:'corbensproducts':''}

{assign var=help value=corbensproducts.$domain/help/}
{assign var=account value=corbensproducts.$domain/Account-Managment/}
{assign var=DOMAINinQUESTION value=corbensproducts.$domain/}



{assign var=utmpBASE value=$node->url|replace:$DOMAINinQUESTION:'corbensproducts.'|replace:'corbensproducts.help/':$help|replace:'corbensproducts.Account-Managment/':$account}
{assign var=utmp value=$utmpBASE|regex_replace:'/ducts.$/':'ducts.com/'}



{if $node->current == true}
<li><a class="title"  href="{$utmp}">{$node->menutext}</a>

{elseif $node->parent == true}
<li><a  class="title2" href="{$utmp}">{$node->menutext}</a>

{elseif $node->type == 'sectionheader'}
<li class="sectionheader">{$node->menutext}

{elseif $node->type == 'separator'}
<li class="separator" style="list-style-type: none;"> <hr />


{else}
<li><a class="title3" href="{$utmp}">{$node->menutext}</a>

{/if}

{/foreach}
{repeat string="</li></ul>" times=$node->depth-1}</li>
</ul>
{/if}<br/>
</div>

{assign var=domain value=$smarty.server.SERVER_NAME|replace:'www.':''|replace:'.':''|replace:'-':''|replace:'corbensproducts':''}

gets the tdl

these set mulity site pages (shared pages)
{assign var=help value=corbensproducts.$domain/help/}
{assign var=account value=corbensproducts.$domain/Account-Managment/}

this it the domain page ownership adjustment

{assign var=DOMAINinQUESTION value=corbensproducts.$domain/}


this applies and corrects for the "defalut" page

{assign var=utmpBASE value=$node->url|replace:$DOMAINinQUESTION:'corbensproducts.'|replace:'corbensproducts.help/':$help|replace:'corbensproducts.Account-Managment/':$account}
{assign var=utmp value=$utmpBASE|regex_replace:'/ducts.$/':'ducts.com/'}


I left the site name in there to make it clearer.... so just replace that with your own... this is set up in the way that the domains are the sams name differnt tdls...



to see it work go here (in this example it's a user site map)

http://www.corbensproducts.net/help/sitemap/
http://www.corbensproducts.com/help/sitemap/
http://www.corbensproducts.biz/help/sitemap/
http://www.corbensproducts.org/help/sitemap/
http://www.corbensproducts.info/help/sitemap/


all the same page... with the shared pages

cheers
jeremyBass
Last edited by JeremyBASS on Tue Dec 09, 2008 3:59 am, edited 1 time in total.
JeremyBASS

Re: My mulity site menu trick

Post by JeremyBASS »

Here is an updated version... This version shows all domains in one menu and also has the blogs in the menu under the page that holds {blogs}...  I'll see if I can dig up the others with the news if anyone wants...

Code: Select all

{if $count > 0}
<div id="menuwrapper" >
<ul id="primary-nav">
{foreach from=$nodelist item=node}
{assign var=domain value=$smarty.server.SERVER_NAME|replace:'www.':''|replace:'.':''|replace:'-':''|replace:'corbensproducts':''}

{assign var=help value=corbensproducts.$domain/help/}
{assign var=account value=corbensproducts.$domain/Account-Managment/}
{assign var=DOMAINinQUESTION value=corbensproducts.$domain/}



{assign var=utmpBASE value=$node->url|replace:$DOMAINinQUESTION:'corbensproducts.'|replace:'corbensproducts.help/':$help|replace:'corbensproducts.Account-Managment/':$account}
{assign var=utmp value=$utmpBASE|regex_replace:'/ducts.$/':'ducts.com/'}
{assign var=BLOGfilter value='http://www.corbensproducts.com/blogs/'}
{assign var=LandingPage value=51}
{assign var=nodefilter value=/$content_id/}
{assign var=landfilter1 value=/$content_id/$LandingPage/}
{assign var=landfilter2 value=/$LandingPage/$content_id/}
{assign var=landfilter3 value=/$LandingPage/}
{if $node->depth > $node->prevdepth}

	{repeat string="<ul>" times=$node->depth-$node->prevdepth}
{elseif $node->depth < $node->prevdepth}

	{repeat string="</li></ul>" times=$node->prevdepth-$node->depth}
	</li>
{elseif $node->index > 0}</li>
{/if}
{if $node->parent == true or ($node->current == true and $node->haschildren == true)}
	<li class="menuactive menuparent"><a class="menuactive menuparent" 
{elseif $node->current == true}
	<li class="menuactive"><a class="menuactive" 
{elseif $node->haschildren == true}
	<li class="menuparent"><a class="menuparent" 
{elseif $node->type == 'sectionheader'}
        <li class="sectionheader"><span> {$node->menutext} </span>
{elseif $node->type == 'separator'}
        <li style="list-style-type: none;"> <hr class="separator" />
{else}
	<li><a 
{/if}
{if $node->type != 'sectionheader' and $node->type != 'separator'}
href="{$utmp}" {if $node->accesskey != ''}accesskey="{$node->accesskey}" {/if}{if $node->tabindex != ''}tabindex="{$node->tabindex}" {/if}{if $node->titleattribute != ''}title="{$node->titleattribute}"{/if}{if $node->target ne ""} target="{$node->target}"{/if}><dfn>{$node->hierarchy}: </dfn>{$node->menutext}</a>
{elseif $node->type == 'sectionheader'}
><dfn>{$node->hierarchy}: </dfn>{$node->menutext}</a>

{/if}
{if $utmp == $BLOGfilter }
<ul >
{capture assign='junk'}{Blogs numentries="50"}{/capture} {foreach from=$items item=entry}  {assign var=utmpBLOGS value=$entry->entryurl|replace:$nodefilter:$landfilter3|replace:$landfilter2:$landfilter1}
<li class="menuparent"><a href="{$utmpBLOGS}">•{$entry->title}</a></li>
{/foreach}
</ul>
{/if}
{/foreach}

	{repeat string="</li></ul>" times=$node->depth-1}		</li>
	</ul>
<div class="clearb"></div>
</div>
{/if}
few things to note in this version...

{assign var=LandingPage value=51} blogs is a page which have id 51... my landing page... So when your replacing corbensproduct.com with your multiple – site domains setups keep in mind that you'll have to make sure you change the blog filter page...

also... this sports static cross domain pages... in this case I choose help and Account-Management... you know so they only have to login once no matter if their in the forum or on the blogs etc...

{assign var=help value=corbensproducts.$domain/help/}
{assign var=account value=corbensproducts.$domain/Account-Managment/}

cheers
jeremyBass
JeremyBASS

Re: My menu tricks -- multiple domains setups -- Blogs

Post by JeremyBASS »

A more condense way... of the same thing...

Code: Select all

{if $count > 0}
<div id="menuwrapper" >
<ul id="primary-nav">
{foreach from=$nodelist item=node}
{assign var=domain value=$smarty.server.SERVER_NAME|replace:'www.':''|replace:'.':''|replace:'-':''|replace:'corbensproducts':''}

{assign var=DOMAINinQUESTION value=corbensproducts.$domain/}

{assign var=help value=corbensproducts.$domain/help/}
{assign var=account value=corbensproducts.$domain/Account-Managment/}

{assign var=utmpBASE value=$node->url|replace:$DOMAINinQUESTION:'corbensproducts.'|replace:'corbensproducts.help/':$help|replace:'corbensproducts.Account-Managment/':$account}
{assign var=utmp value=$utmpBASE|regex_replace:'/ducts.$/':'ducts.com/'}


{assign var=BLOGfilter value='http://www.corbensproducts.com/blogs/'}
{assign var=LandingPage value=51}
{assign var=nodefilter value=/$content_id/}
{assign var=landfilter1 value=/$content_id/$LandingPage/}
{assign var=landfilter2 value=/$LandingPage/$content_id/}
{assign var=landfilter3 value=/$LandingPage/}



{if $node->depth > $node->prevdepth}

	{repeat string="<ul>" times=$node->depth-$node->prevdepth}
{elseif $node->depth < $node->prevdepth}

	{repeat string="</li></ul>" times=$node->prevdepth-$node->depth}
	</li>
{elseif $node->index > 0}</li>
{/if}

<li class="{if $node->parent == true or ($node->current == true and $node->haschildren == true)}menuactive menuparent{elseif $node->current == true}menuactive{elseif $node->haschildren == true}menuparent{/if}" > <a href="{$utmp}" {if $node->accesskey != ''}accesskey="{$node->accesskey}" {/if}{if $node->tabindex != ''}tabindex="{$node->tabindex}" {/if}{if $node->titleattribute != ''}title="{$node->titleattribute}"{/if}{if $node->target ne ""} target="{$node->target}"{/if}><dfn>{$node->hierarchy}: </dfn>{$node->menutext}</a>
 {if $utmp == $BLOGfilter }
<ul >
{capture assign='junk'}{Blogs numentries="50"}{/capture} {foreach from=$items item=entry}  {assign var=utmpBLOGS value=$entry->entryurl|replace:$nodefilter:$landfilter3|replace:$landfilter2:$landfilter1}
<li class="menuparent"><a href="{$utmpBLOGS}">•{$entry->title}</a></li>
{/foreach}
</ul>
{/if}

{/foreach}


	{repeat string="</li></ul>" times=$node->depth-1}		</li>
	</ul>
<div class="clearb"></div>
</div>
{/if}


add

{if $ccuser->loggedin()}
{cms_module module='menumanager' template='MultiSiteMenu' collapse='0'  }
{else}
{cms_module module='menumanager' template='MultiSiteMenu' collapse='0' excludeprefix="Account-Managment" }
{/if}

and the cross domain Account-Managment only shows up only when signed in.. I'm sure i'll get duhs for that... just being helpful...
Post Reply

Return to “Tips and Tricks”