forward and back links that go through every page even if they set not to show
Posted: Fri May 21, 2010 8:23 am
First you need to install cgsimplesmarty and i would choose to make these Global Content Blocks
Previous link
Next link
Previous link
Code: Select all
{$cgsimple->get_sibling("prev","prev_sibling")}
{* check there is a previous sibling *}
{if !empty($prev_sibling)}
{$cgsimple->has_children($prev_sibling, 'prev_has_children')}
{* check previous sibling has a child then retrieve last child *}
{if !empty($prev_has_children)}
{$cgsimple->get_children($prev_sibling, true, "prev_get_children")}
{capture assign="prevLastChild"}{$prev_get_children|@count}{/capture}
{capture assign="prevArrayLast"}{math equation="x - 1" x=$prevLastChild}{/capture}
{capture assign="prevGotChild"}{$prev_get_children[$prevArrayLast].alias}{/capture}
{capture assign="prevGotChildTitle"}{$prev_get_children[$prevArrayLast].title}{/capture}
{cms_selflink page="$prevGotChild" text="Prev"}
{else}
{* Just show previous link as there are no children *}
{if !empty($prev_sibling)}
{cms_selflink page="$prev_sibling" text="$prevGotChildTitle"}
{/if}
{/if}
{else}
{$cgsimple->get_parent_alias("","prev_parent_alias")}
{if !empty($prev_parent_alias)}
{$cgsimple->get_page_title($prev_parent_alias, 'prev_parent_title')}
{cms_selflink page="$prev_parent_alias" text="$prev_parent_title"}{/if}
{/if}
Code: Select all
{$cgsimple->has_children('', 'has_children')}
{if !empty($has_children)}
{$cgsimple->get_children("",true, "get_children")}
{capture assign="gotChild"}{$get_children[0].alias}{/capture}
{capture assign="gotChildTitle"}{$get_children[0].title}{/capture}
{cms_selflink page="$gotChild" text="$gotChildTitle"}
{else}
{$cgsimple->get_sibling("next","next_sibling")}
{if !empty($next_sibling)}
{cms_selflink page="$next_sibling" text="Next"}{/if}
{/if}