[SOLVED] breadcrumps, but not on the homepage
[SOLVED] breadcrumps, but not on the homepage
Hi,
Does anyone knows if it's possible to add breadcrumps, exluding the first page, I don't find any parameter to exclude this.
thanks in advance
Does anyone knows if it's possible to add breadcrumps, exluding the first page, I don't find any parameter to exclude this.
thanks in advance
Last edited by swiftgs on Sun Dec 21, 2008 10:31 pm, edited 1 time in total.
Re: breadcrumps, but not on the homepage
How about a little wrapper around it...
{if $page_alias neq 'home'}
{breadcrumbs.....}
{end}
Ronny
{if $page_alias neq 'home'}
{breadcrumbs.....}
{end}
Ronny
Re: breadcrumps, but not on the homepage
tnx for the very fast reply!
However I'm not so good (read no experience at all) with php, so I found the function.breadcrumps.php file and try to add it, but it gives a error and nothing happens when loading the site:
Parse error: syntax error, unexpected T_VARIABLE, expecting '(' in /........
this is the code:
But where do I add the:
tried to add it at he build section but unfortunately it doesn't work! Gues I'm doing something wrong

tnx!
However I'm not so good (read no experience at all) with php, so I found the function.breadcrumps.php file and try to add it, but it gives a error and nothing happens when loading the site:
Parse error: syntax error, unexpected T_VARIABLE, expecting '(' in /........
this is the code:
Code: Select all
<?php
#CMS - CMS Made Simple
#(c)2004 by Ted Kulp (wishy@users.sf.net)
#This project's homepage is: http://cmsmadesimple.sf.net
#
#This program is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2 of the License, or
#(at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
function smarty_cms_function_breadcrumbs($params, &$smarty)
{
global $gCms;
$manager = &$gCms->GetHierarchyManager();
$thispage = $gCms->variables['content_id'];
$trail = "";
#Check if user has specified a delimiter, otherwise use default
if (isset($params['delimiter'])) {
$delimiter = $params['delimiter'];
} else {
$delimiter = ">>";
}
#Check if user has requested an initial delimiter
if (isset($params['initial'])) {
if ($params['initial'] == "1") {
$trail .= $delimiter . " ";
}
}
$root='##ROOT_NODE##';
#Check if user has requested the list to start with a specific page
if (isset($params['root'])) {
$root = $params['root'];
}
$root_url='';
#Check if user has requested to overrided the root URL
if (isset($params['root_url'])) {
$root_url = $params['root_url'];
}
$endNode = &$manager->sureGetNodeById($thispage);
# build path
if (isset($endNode))
{
$content =& $endNode->getContent();
$path=array($endNode);
$currentNode = &$endNode->getParentNode();
while (isset($currentNode) && $currentNode->getLevel() >= 0)
{
$content = &$currentNode->getContent();
if (isset($content))
{
//Add current node to the path and then check to see if
//current node is the set root
//as long as it's not hidden
if( $content->ShowInMenu() && $content->Active() )
{
$path[] = $currentNode;
}
if (strtolower($content->Alias())!=strtolower($root))
{
//Get the parent node and loop
$currentNode = &$currentNode->getParentNode();
}
else
{
//No need to get the parent node -- we're the set root already
break;
}
}
else
{
//There are more serious problems here, dump out while we can
break;
}
}
if ($root!='##ROOT_NODE##') {
# check if the last added is root. if not, add id
$currentNode = &$manager->sureGetNodeByAlias($root);
if (isset($currentNode))
{
$content = &$currentNode->getContent();
if (isset($content) && (strtolower($content->Alias()) == strtolower($root)))
{
$node = &$manager->sureGetNodeByAlias($root);
if (isset($node)) {
$content = &$node->getContent();
if ($content->Id()!=$thispage)
$path[] = $node; # do not add if this is the current page
}
}
}
}
$classid=isset($params['classid'])?(' class="' . $params['classid'] . '"'):'';
$currentclassid=isset($params['currentclassid'])?(' class="' . $params['currentclassid'] . '"'):'';
# now create the trail (by iterating through the path we built, backwards)
for ($i=count($path)-1;$i>=0;$i--) {
$node = &$path[$i];
if (isset($node))
{
$onecontent = &$node->getContent();
if ($onecontent->Id() != $thispage && $onecontent->Type() != 'seperator') {
if (($onecontent->getURL() != "") && ($onecontent->Type() != 'sectionheader')) {
if ($onecontent->DefaultContent() && false == empty($root_url))
{
$trail .= '<a href="' . $root_url . '"';
}
else
{
$trail .= '<a href="' . $onecontent->getURL() . '"';
}
$trail .= $classid;
$trail .= '>';
$trail .= cms_htmlentities($onecontent->MenuText()!=''?$onecontent->MenuText():$onecontent->Name());
$trail .= '</a> ';
} else {
$trail .= "<span $classid>";
$trail .= cms_htmlentities($onecontent->MenuText()!=''?$onecontent->MenuText():$onecontent->Name());
$trail .= '</span>';
$trail .= ' ';
}
$trail .= $delimiter . ' ';
} else {
if (isset($params['currentclassid'])) {
$trail .= "<span $currentclassid>";
} else {
$trail .= '<span class="lastitem">';
}
$trail .= cms_htmlentities($onecontent->MenuText()!=''?$onecontent->MenuText():$onecontent->Name());
if (isset($params['currentclassid'])) {
$trail .= '</span>';
} else {
$trail .= '</span>';
}
}
}
}
}
if (isset($params['starttext']) && $params['starttext'] != '')
{
$trail = $params['starttext'] . ': ' . $trail;
}
return $trail;
}
function smarty_cms_help_function_breadcrumbs() {
echo lang('help_function_breadcrumbs');
}
function smarty_cms_about_function_breadcrumbs() {
echo lang('about_function_breadcrumbs');
}
# vim:ts=4 sw=4 noet
?>
Code: Select all
{if $page_alias neq 'home'}
{breadcrumbs.....}
{end}


tnx!
Re: breadcrumps, but not on the homepage
You add it to your page template, where the {breadcrumbs} tag is now.
Nullig
Nullig
Re: breadcrumps, but not on the homepage
again thanks for the fast reply, I added it in the template, that's not so hard, but again it fails to load the page... 
this is added in the template, but still no luck.... (it worked without the first and last sentence, but then it's also shown on the home page. This is the error when calling the page:
string(114) "Smarty error: [in template:21 line 97]: syntax error: unrecognized tag 'end' (Smarty_Compiler.class.php, line 590)" string(129) "Smarty error: [in template:21 line 114]: syntax error: unclosed tag \{if} (opened line 95). (Smarty_Compiler.class.php, line 317)"

Code: Select all
<div id="maincontent">
{if $page_alias neq 'home'}
{breadcrumbs starttext='you are here' delimiter='-'}
{end}
{content}
</div>
string(114) "Smarty error: [in template:21 line 97]: syntax error: unrecognized tag 'end' (Smarty_Compiler.class.php, line 590)" string(129) "Smarty error: [in template:21 line 114]: syntax error: unclosed tag \{if} (opened line 95). (Smarty_Compiler.class.php, line 317)"
Re: breadcrumps, but not on the homepage
Yes, it should be:
{if $page_alias neq 'home'}
{breadcrumbs starttext='you are here' delimiter='-'}
{/if}
Nullig
{if $page_alias neq 'home'}
{breadcrumbs starttext='you are here' delimiter='-'}
{/if}
Nullig
Re: breadcrumps, but not on the homepage
nullig and RonnyK tnx you very much! works like a charm now 

Re: [SOLVED] breadcrumps, but not on the homepage
You can exclude whole first-level menu. I did this in that way:
but at first you have to upload file \lib\smarty\plugins\modifier.strpos.php (attachment)
ps. I should add it to Tips and Tricks subforum...
Code: Select all
{if ($friendly_position|strpos:"." !== FALSE)}
{breadcrumbs starttext='you are here' delimiter='>'}
{/if}
ps. I should add it to Tips and Tricks subforum...
- Attachments
-
[The extension txt has been deactivated and can no longer be displayed.]
Last edited by korpirkor on Mon Dec 22, 2008 1:38 am, edited 1 time in total.
[url=http://www.polishwebdesign.pl/]Polish WebDesign Cezary Nowak
Projektowanie stron WWW[/ur]
Projektowanie stron WWW[/ur]