Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Bread Crumb on Deatailed Page Question

Quote Reply
Bread Crumb on Deatailed Page Question
Right now in detailed.html I am using below tag for displaying breadcrumb:

<%Links::Utils::format_title($title_loop, separator => $crumb_separator, no_escape_separator => $no_escape_crumb_separator, include_home => 1, link_type => 2)%>

I was wondering if anyone can tell me what tag shall I use so that the bread crumb will not display the "Title" of the link/listing. So it appears as

Home :: Category Name :: Sub category Name ::
instead of
Home :: Category Name :: Sub category Name :: Title of Link.

============================
When I use GT:Template:Dump tag. I can see that in title loop there is a proper link, but I don't know how do I use it in a tag so it will work as above.

title_loop [
{
'Name' => 'Site Title',
'URL' => 'http://www.domain.com/index.php'
},
{
'Name' => 'root cat 1',
'URL' => 'http://www.domain.com/root-cat-1/index.php'
},
{
'Name' => 'sub cat 1',
'URL' => 'http://www.domain.com/root-cat-1/sub-cat-1/index.php'
},
{
'Name' => 'This is the link title, this is the link title',
'URL' => 'http://www.domain.com/root-cat-1/sub-cat-1/this is the link title, this is the link title/index.php'
}
];




Thanks for the help.

Vishal

Vishal
-------------------------------------------------------

Last edited by:

SWDevil.Com: Nov 30, 2005, 2:47 PM
Quote Reply
Re: [SWDevil.Com] Bread Crumb on Deatailed Page Question In reply to
I think you may find this interesting :

http://www.gossamer-threads.com/...i?post=284774#284774

Which is what Adrian explains about here :

http://www.gossamer-threads.com/...i?post=286893#286893

You need to write a global to do it basically

John
Significant Media
Quote Reply
Re: [Jag] Bread Crumb on Deatailed Page Question In reply to
Hello John,

Thanks for the very helpful link.

I tried using the global as mentioned at http://www.gossamer-threads.com/perl/gforum/gforum.cgi?post=284774 however I am getting error.

I used below code as global code
Quote:
sub {

my ($title_loop, %options) = @_;

return unless $title_loop; my %vars = %{GT::Template->vars};

my $ret;

$options{separator} = GT::CGI::html_escape($options{separator}) unless $options{no_escape_separator};

for (0 .. $#$title_loop) {

next unless $_ or $options{include_home};

if ($options{link_type} == 1 or

($options{link_type} == 2 and $_ != $#$title_loop)) {

$ret .= qq|<a href="$title_loop->[$_]->{URL}">$title_loop->[$_]->{Name}</a>|;

}

else {

unless ($options{no_last} == 1 and $_ == $#$title_loop) {

$ret .= $title_loop->[$_]->{Name};

}

}

$ret .= $options{separator} unless $_ == $#$title_loop;

}

if ($options{link_type} == 3) {

$ret = qq|<a href="$title_loop->[-1]->{URL}">$ret</a>|;

}

return \$ret;

}

And used <%global_name%> as calling tag, but it did not worked. :(


Vishal

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] Bread Crumb on Deatailed Page Question In reply to
Hi Vishal,

To furher the discussion, and I'm not sure I'll be able to help because the global looks pretty complicated, you'll need to provide the error you're getting. Links will provide you with a more detailed error message if you set debugging on in the admin panel in setup > Misc Options

John
Significant Media
Quote Reply
Re: [Jag] Bread Crumb on Deatailed Page Question In reply to
Hello John,

Here is the error that I received.

Quote:

A fatal error has occured:
Not an ARRAY reference at (eval 40) line 11.
Please enable debugging in setup for more details.
Stack Trace
======================================
Links (24082): Links::environment called at /home/user/public_html/1/cgi/admin/Links.pm line 712 with no arguments.
Links (24082): Links::fatal called at (eval 40) line 11 with arguments
(Not an ARRAY reference at (eval 40) line 11.
).
Links (24082): Links::__ANON__ called at /home/user/public_html/1/cgi/admin/GT/Template.pm line 815 with arguments
(HASH(0x87da6bc)).
Links (24082): GT::Template::_get_var called at /home/user/public_html/1/cgi/admin/templates/luna/compiled/detailed.html.compiled line 53 with arguments
(GT::Template=HASH(0x870f428), detailed_bread_crumb_without_title, 0, 1).
Links (24082): GT::Template::parsed_template called at /home/user/public_html/1/cgi/admin/GT/Template.pm line 525 with arguments
(GT::Template=HASH(0x870f428)).
Links (24082): GT::Template::_parse called at /home/user/public_html/1/cgi/admin/GT/Template.pm line 143 with arguments
(GT::Template=HASH(0x870f428), detailed.html, HASH(0x86e64e0)).
Links (24082): GT::Template::parse called at /home/user/public_html/1/cgi/admin/Links.pm line 445 with arguments
(GT::Template, detailed.html, ARRAY(0x87068b8), HASH(0x86e64e0)).
Links (24082): Links::user_page called at /home/user/public_html/1/cgi/admin/Links/SiteHTML.pm line 179 with arguments
(detailed.html, HASH(0x86e80f8), HASH(0x86e64e0)).
Links (24082): Links::SiteHTML::site_html_detailed called at /home/user/public_html/1/cgi/admin/GT/Plugins.pm line 133 with arguments
(HASH(0x86e80f8), [undef]).
Links (24082): GT::Plugins::dispatch called at /home/user/public_html/1/cgi/admin/Links/SiteHTML.pm line 27 with arguments
(GT::Plugins=HASH(0x8308c18), site_html_detailed, *Links::SiteHTML::site_html_detailed, HASH(0x86e80f8), [undef]).
Links (24082): Links::SiteHTML::display called at Links::Build::build_detailed line 548 with arguments
(detailed, HASH(0x86e80f8)).
Links (24082): Links::Build::build_detailed called at /home/user/public_html/1/cgi/admin/GT/Plugins.pm line 133 with arguments
(HASH(0x85714a8)).
Links (24082): GT::Plugins::dispatch called at /home/user/public_html/1/cgi/admin/Links/Build.pm line 30 with arguments
(GT::Plugins=HASH(0x8308c18), build_detailed, CODE(0x84291b4), HASH(0x85714a8)).
Links (24082): Links::Build::build called at /home/user/public_html/1/cgi/admin/Links/User/Page.pm line 215 with arguments
(detailed, HASH(0x85714a8)).
Links (24082): Links::User::Page::generate_detailed_page called at /home/user/public_html/1/cgi/admin/GT/Plugins.pm line 133 with arguments
(HASH(0x830a8f0)).
Links (24082): GT::Plugins::dispatch called at /home/user/public_html/1/cgi/admin/Links/User/Page.pm line 52 with arguments
(GT::Plugins=HASH(0x8308c18), generate_detailed, CODE(0x81e6da0), HASH(0x830a8f0)).
Links (24082): Links::User::Page::handle called at /home/user/public_html/1/cgi/admin/GT/Plugins.pm line 133 with no arguments.
Links (24082): GT::Plugins::dispatch called at page.cgi line 26 with arguments
(GT::Plugins=HASH(0x8308c18), handle_page, CODE(0x81584b4)).
System Information
======================================
Current user: user (32018)
Perl version: 5.8.6
Gossamer Links version: 3.0.4
GT::SQL version: 1.111
GT::Template version: 2.142
DBI.pm Version: 1.48
Running under mod_perl: No
Running under SpeedyCGI: No
@INC =
/home/user/public_html/1/cgi/admin
/usr/lib/perl5/5.8.6/i686-linux
/usr/lib/perl5/5.8.6
/usr/lib/perl5/site_perl/5.8.6/i686-linux
/usr/lib/perl5/site_perl/5.8.6
/usr/lib/perl5/site_perl/5.8.3
/usr/lib/perl5/site_perl/5.8.2
/usr/lib/perl5/site_perl/5.8.1
/usr/lib/perl5/site_perl/5.8.0
/usr/lib/perl5/site_perl
.
CGI Input
======================================
d => 1
g => 1/hosts/9690.php
Environment
======================================
DOCUMENT_ROOT => /home/user/public_html
GATEWAY_INTERFACE => CGI/1.1
GT_TMPDIR => /home/user/public_html/1/cgi/admin/tmp
HTTP_ACCEPT => */*
HTTP_ACCEPT_LANGUAGE => en-us
HTTP_CONNECTION => Keep-Alive
HTTP_HOST => www.domain.com
HTTP_REFERER => http://www.domain.com/...pany%2Findex.php;d=1
HTTP_USER_AGENT => Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; InfoPath.1)
HTTP________________ => ----- -------
PATH => /usr/local/bin:/usr/bin:/bin
QUERY_STRING => g=1%2Fhosts%2F9690.php;d=1
REMOTE_ADDR => 68.12.109.130
REMOTE_PORT => 32849
REQUEST_METHOD => GET
REQUEST_URI => /1/cgi/page.cgi?g=1%2Fhosts%2F9690.php;d=1
SCRIPT_FILENAME => /home/user/public_html/1/cgi/page.cgi
SCRIPT_NAME => /1/cgi/page.cgi
SERVER_ADDR => 123.456.789.123 (site IP here)
SERVER_ADMIN => webmaster@domain.com
SERVER_NAME => www.domain.com
SERVER_PORT => 80
SERVER_PROTOCOL => HTTP/1.1
SERVER_SOFTWARE => Apache/1.3.34 (Unix) mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 PHP/4.3.11 FrontPage/5.0.2.2635 mod_ssl/2.8.25 OpenSSL/0.9.7a


How do you think this error can be fixed so that the global will work.

Your help is very much appreciated.

Vishal

Vishal
-------------------------------------------------------
Quote Reply
Re: [SWDevil.Com] Bread Crumb on Deatailed Page Question In reply to
Hi,

The problem is that you are not passing any options through to the global which was written in the same way as the format_title global that it is replacing.

Also it is good idea to follow exactly the same procedure that is indicated in the post and then modify it once you have got it working. In jdgamble's post the global is called "format_title_override". This is the name Adrian has indicated can be used to override the normal "format_title" routine in Utils.pm

What you need to do is read through the code and provide options where appropriate.

To give you an example you could have this :

<%format_title_override($title_loop, separator => $crumb_separator, no_escape_separator => 1, include_home => 1, link_type => 2, no_last=>1)%>

To see what the numbers in the options mean it is indicated in the format_title routine or you can see it here :
http://www.gossamer-threads.com/...i?post=284774#284774

The "format_title_override" global will need to be used instead of the "format_title" code BTW, using both would provide you with the bread crumb twice.

If you look at the different options I have used they are all options available in the code below.

Code:
sub {
my ($title_loop, %options) = @_;
return unless $title_loop; my %vars = %{GT::Template->vars};
my $ret;
$options{separator} = GT::CGI::html_escape($options{separator}) unless $options{no_escape_separator};
for (0 .. $#$title_loop) {
next unless $_ or $options{include_home};
if ($options{link_type} == 1 or
($options{link_type} == 2 and $_ != $#$title_loop)) {
$ret .= qq|<a href="$title_loop->[$_]->{URL}">$title_loop->[$_]->{Name}</a>|;
}
else {
unless ($options{no_last} == 1 and $_ == $#$title_loop) {
$ret .= $title_loop->[$_]->{Name};
}
}
$ret .= $options{separator} unless $_ == $#$title_loop;
}
if ($options{link_type} == 3) {
$ret = qq|<a href="$title_loop->[-1]->{URL}">$ret</a>|;
}
return \$ret;
}

Again this the code provided by jdgamble here :
http://www.gossamer-threads.com/...i?post=284775#284775

This should help you get the appropriate effect on your pages...

John
Significant Media
Quote Reply
Re: [Jag] Bread Crumb on Deatailed Page Question In reply to
Hello John,

Thank you for the making things clear and for very informative post. I noticed where I was making the mistake and also you writing the global again surely helped me a lot.

It worked 100% as required.

Thank you again for the wonderful help.

Vishal

Vishal
-------------------------------------------------------