I’m developing two static-content heavy sites at the moment, and am trying to use Mr Huot’s Pages mod to run basically everything. I’ve got the index template of the group set to be the default static template, and pull dynamic content into it in a couple of places from other weblogs. It makes for a really clean template structure, easy menus, minimal hard-coding and gives the client the ability to add new menu-items through the CMS. Perfect!
It’s just dreamy, until … I try to look at the site by entering just the root URL.
I want www.mysite.net or www.mysite.net/index.php to show the same thing as www.mysite.net/index.php/home, but it seems that when the category isn’t specified in the URL the mod’s global variables don’t get defined, and the menus collapse in a heap of dust and a really nasty parse error.
Have I run up against a natural limit of the Pages mod, or am I missing something?
[Mod Edit: Moved to the Modules forum as it is more appropriate. Also re-titled to avoid confusion with the first-party Pages module.]
Ah. Menus.
Here’s my solution:
<div id="menu" class="heading">
<ul>
{if static_page == ""}
{exp:weblog:categories weblog="content" parent_only="yes" style="linear" show_empty="no"}
<li>
<a href="http://{path=}<?php" title="Link to {category_name}"> {category_name}</a>
</li>
{/exp:weblog:categories}
{if:else}
{exp:static_page_path direction="post" nest="false" page="0" depth="1" show_empty="no"}
<li>
<a href="http://{url_title}" title="Link to {title}" class="current">{title}</a>
</li>
{/exp:static_page_path}
{/if}
</ul>
</div>
Looking at it with fresh eyes, though. I might be able to use an embed variable to pass the static page id into the sub-template. Hmmmmm.
Well, it’s kind of a mess, but here’s my main nav (parents only):
<div id="mainnav">
{if seg_1 == "index.php" && seg_2 == ""}
<?php $count = 1; ?>
<ul>
{exp:weblog:categories weblog="pages" style="linear" show_empty="yes" parent_only="yes"}
<li><a href="http://{site_url}{category_url_title}class=page_<?=$count++?>">{category_name}</a></li>
{/exp:weblog:categories}
</ul>
{if:elseif seg_1 == ""}
<?php $count = 1; ?>
<ul>
{exp:weblog:categories weblog="pages" style="linear" show_empty="yes" parent_only="yes"}
<li><a href="http://{site_url}{category_url_title}class=page_<?=$count++?>">{category_name}</a></li>
{/exp:weblog:categories}
</ul>
{if:else}
<?php $count = 1; ?>
<ul>
{exp:static_tome_path direction="post" page="0" depth="1" nest="false"}
<li><a href="http://{url_title}class=page_<?=$count++?>">{title}</a></li>
{/exp:static_tome_path}
</ul>
{/if}
</div><!-- #mainnav -->
Hi,
I’m having similar problems with static_tome_path. I can’t get the menu to appear on my home page. I’ve tried a few of the solutions above to no avail.
I have this in my site’s header template.
{if static_page == ""}{assign_variable:static_page="35"}{/if}
Where 35 is the ID of the tome page for /home - a top level category.
I might could just pull some redirect stuff via apache but seems like other people have worked this out without resorting to that. What am I missing? Here’s my menu code:
<div id="nav">
{exp:static_tome_path direction="post" page="0" depth="0" }
<a href="http://{url_title}" title="Link to {title}" class="{short_name}-nav">{title}</a>
{/exp:static_tome_path}
</div>
The menu lives in the footer include. I tried sticking the if statement in my footer as well, just in case, to no avail.
Thanks for any insight.
Will
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.