Start
Help
Forum
Addons
Project
Welcome,
Guest
. Please
login
or
register
.
July 05, 2009, 04:51:07 AM
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Search:
Advanced search
You wanna join the Website Baker team?
For more Informations read
here
or on our
Startpage
.
85293
Posts in
13125
Topics by
8214
Members
Latest Member:
Nebz
Website Baker Community Forum
English
Archive
(Moderators:
Argos
,
BerndJM
)
Breadcrumb module
Pages:
[
1
]
2
Author
Topic: Breadcrumb module (Read 14286 times)
sucresemoule
Pending Apprentice Baker
Offline
Posts: 42
Breadcrumb module
«
on:
April 18, 2005, 12:37:20 PM »
I developped a small breadcrumb module based on code by Ryan and some other code from templates and other modules...
http://goliwok.com/jm/wbaker/breadcrumb.zip
It generates (like all not cached breadcrumbs) a lot of sql queries
I will add a smarty version soon to make it faster.
Logged
Stefan
Guest
Breadcrumb module
«
Reply #1 on:
April 18, 2005, 01:25:09 PM »
Instead of using my old create_breadcrumbs code, you should rather utilize the new page_trail sql entry. It stores the same information as $bca.
Other than that: thanks for converting it into a module!
Logged
Hans
Geek-Like Baker
Offline
Posts: 423
Breadcrumb module
«
Reply #2 on:
April 18, 2005, 02:12:27 PM »
Thanks for this nice module. I have a question. When I am on this page:
http://www.domainname.nl/wb/pages/welkom/nogmaals-welkom.php
the breadcrumb shows like this:
Home : Welkom : Nogmaals welkom >>
I would rather have it displayed like
Home : Welkom >>
and then comes the title of the page as I write it in wysiwyg. In most cases the "wysiwyg title" is the same as the page-title and this way I can prevent it from showing up two times.
E.G
Home : Welkom : Nogmaals welkom >>
Nogmaals welkom
should read:
Home : Welkom >>
Nogmaals welkom
Logged
Hans - Nijmegen - The Netherlands
sucresemoule
Pending Apprentice Baker
Offline
Posts: 42
Breadcrumb module
«
Reply #3 on:
April 18, 2005, 02:27:03 PM »
Quote from: Stefan
Instead of using my old create_breadcrumbs code, you should rather utilize the new page_trail sql entry. It stores the same information as $bca.
Other than that: thanks for converting it into a module!
I am gonna have a look on that page_trail thing.
Logged
sucresemoule
Pending Apprentice Baker
Offline
Posts: 42
Breadcrumb module
«
Reply #4 on:
April 18, 2005, 03:10:04 PM »
I added an option to show or hide the current page title.
http://goliwok.com/jm/wbaker/breadcrumb.zip
Added credits to Stefan in the info.php page
Logged
Hans
Geek-Like Baker
Offline
Posts: 423
Breadcrumb module
«
Reply #5 on:
April 18, 2005, 03:15:17 PM »
Thank you!! Great!
Hans
Logged
Hans - Nijmegen - The Netherlands
glenn
Pending Apprentice Baker
Offline
Posts: 17
Re: Breadcrumb module
«
Reply #6 on:
August 30, 2005, 04:16:12 AM »
is there any way to intregrate the breadcrumbs directrly into the template.
for example, the content is "<?php page_content(); ?>
Logged
-------
www.dvize.com/website-baker.html
www.futureaustralia.net
pcwacht
Guest
Re: Breadcrumb module
«
Reply #7 on:
August 30, 2005, 08:39:58 AM »
Yes there is.
Copy this code to the top of your templates's index.php
Code:
<?php
function
create_breadcrumbs
(
$item
) {
global
$database
;
global
$bca
;
$query_menu
=
$database
->
query
(
"SELECT page_id,parent FROM "
.
TABLE_PREFIX
.
"pages WHERE page_id = '$item'"
);
$page
=
$query_menu
->
fetchRow
();
if (
$page
[
'parent'
]!=
0
)
create_breadcrumbs
(
$page
[
'parent'
]);
else
$bca
[]=
'0'
;
$bca
[]=
$page
[
'page_id'
];
}
function
breadcrumbs
(
$page_id
,
$sep
=
' > '
,
$tier
=
1
,
$links
=
true
) {
if (
$page_id
!=
0
)
{
global
$database
;
global
$bca
;
if (
sizeof
(
$bca
)==
0
)
    create_breadcrumbs
(
$page_id
);
$counter
=
0
;
foreach (
$bca
as
$temp
)
{
if (
$counter
>=(
tier
-
1
));
 Â
{
 Â
if (
$counter
>
$tier
)
echo
$sep
;
$query_menu
=
$database
->
query
(
"SELECT menu_title,link FROM "
.
TABLE_PREFIX
.
"pages WHERE page_id=$temp"
);
$page
=
$query_menu
->
fetchRow
();
if (
$links
==
true
AND
$temp
!=
$page_id
)
echo
'<a href="'
.
page_link
(
$page
[
'link'
]).
'">'
.
$page
[
'menu_title'
].
'</a>'
;
else
 Â
echo
stripslashes
(
$page
[
'menu_title'
]);
}
    $counter
++;
}
echo
"\n"
;
}
}
?>
call it from within the template with
Code:
<?php create_breadcrumbs
();
?>
at the place you need the breadcrumb.
I don't know if this is old code. But this one works for me
Have fun,
John
«
Last Edit: September 15, 2005, 08:28:48 PM by pcwacht
»
Logged
Leigh
Pending Apprentice Baker
Offline
Posts: 34
Re: Breadcrumb module
«
Reply #8 on:
August 30, 2005, 05:16:16 PM »
@John, I copy & pasted you code into my
index.php
, but I get the following warning:
Warning: Missing argument 1 for create_breadcrumbs() in C:\Inetpub\wwwroot\wb\templates\stylish\index.php on line 114
Could you tell me what parameter I'm missing?
Secondly, as an observation, doesn't it make sense to put a breadcrumb trail in the template, rather than as a module?
Logged
Stefan
Guest
Re: Breadcrumb module
«
Reply #9 on:
August 30, 2005, 05:27:20 PM »
Please look directly at
my script
for a full documentation.
To call it, you need to use <?php breadcrumbs(PAGE_ID); ?>
and yes, I agree, this belongs into the template. That's what it was originally meant for.
Logged
Leigh
Pending Apprentice Baker
Offline
Posts: 34
Re: Breadcrumb module
«
Reply #10 on:
August 30, 2005, 05:32:28 PM »
Thanks Stefan, I was missing the documentation at the beginning of the script. All is now working.
Shouldn't your code be put in the "Completed Code Snippets" section?
«
Last Edit: August 30, 2005, 05:34:40 PM by Leigh
»
Logged
Stefan
Guest
Re: Breadcrumb module
«
Reply #11 on:
August 30, 2005, 06:00:37 PM »
Well, it's not really optimal anymore as there is now a way to achieve the same result with a couple less SQL calls. I have been wanting to rewrite it all the time...
Logged
Argos
Moderator
"All I Do Is Bake" Baker
Offline
Posts: 985
Re: Breadcrumb module
«
Reply #12 on:
September 15, 2005, 01:24:24 PM »
Stefan, I would like to have a link to home in all paths, how can I do that?
So for example: home > item3 > subitem2
Logged
Jurgen Nijhuis
Argos Media
www.argosmedia.nl
WB sites: vitiligo.nl, vanbetuwgrafischontwerp.nl, pauladudok.nl,ksi-advies.nl, maycroft.com, bakker-schilder.nl, bruschke.nl, bereikbaarheid.nl, nvpit.nl, kerncompany.nl, wijnenspijs.nl, almerehuren.nl
Stefan
Guest
Re: Breadcrumb module
«
Reply #13 on:
September 15, 2005, 02:08:01 PM »
Just hardcode the part to the first '>'.
Logged
Argos
Moderator
"All I Do Is Bake" Baker
Offline
Posts: 985
Re: Breadcrumb module
«
Reply #14 on:
September 15, 2005, 03:11:31 PM »
Quote from: Stefan on September 15, 2005, 02:08:01 PM
Just hardcode the part to the first '>'.
Ah! "just hardcode"
Well, I already figured out that that was the place to do something, but since I am no coder I have no clue what to write there. I want the "home" to be a link too, so just write "home" after echo will not do the trick I guess. Can you please tell me what to do exactly? Please?
Logged
Jurgen Nijhuis
Argos Media
www.argosmedia.nl
WB sites: vitiligo.nl, vanbetuwgrafischontwerp.nl, pauladudok.nl,ksi-advies.nl, maycroft.com, bakker-schilder.nl, bruschke.nl, bereikbaarheid.nl, nvpit.nl, kerncompany.nl, wijnenspijs.nl, almerehuren.nl
pcwacht
Guest
Re: Breadcrumb module
«
Reply #15 on:
September 15, 2005, 03:17:05 PM »
Try:
<a href="
http://someplacecalledhome
">Home > </a><?php breadcrumbs(PAGE_ID); ?>
or simular in your template
Have fun!
John
Logged
Argos
Moderator
"All I Do Is Bake" Baker
Offline
Posts: 985
Re: Breadcrumb module
«
Reply #16 on:
September 15, 2005, 04:08:53 PM »
Quote from: pcwacht on September 15, 2005, 03:17:05 PM
Try:
<a href="
http://someplacecalledhome
">Home > </a><?php breadcrumbs(PAGE_ID); ?>
or simular in your template
Quite clever and so obvious that I didn't think of that. Works nicely ofcourse, however there is one small problem: on the homepage I have now "Home > Home"
So an adaptation to the breadcrumb script would be nicer...
Logged
Jurgen Nijhuis
Argos Media
www.argosmedia.nl
WB sites: vitiligo.nl, vanbetuwgrafischontwerp.nl, pauladudok.nl,ksi-advies.nl, maycroft.com, bakker-schilder.nl, bruschke.nl, bereikbaarheid.nl, nvpit.nl, kerncompany.nl, wijnenspijs.nl, almerehuren.nl
pcwacht
Guest
Re: Breadcrumb module
«
Reply #17 on:
September 15, 2005, 08:27:51 PM »
Did have a wee look at breadcrumbs script
Doesn't seem like an easy adaption
Maybe something like this might work at template level
Code:
<?php
if (
PAGE_ID
==
1
)
breadcrumbs
(
PAGE_ID
);
else
?>
<a href="http://someplacecalledhome">Home > </a>
<?php breadcrumbs
(
PAGE_ID
);
?>
Change the number 1 to whatever your Home pageid is
Have fun!
John
Logged
Argos
Moderator
"All I Do Is Bake" Baker
Offline
Posts: 985
Re: Breadcrumb module
«
Reply #18 on:
September 18, 2005, 03:08:23 AM »
Nope, that gives me 3 times "home" in a row
Logged
Jurgen Nijhuis
Argos Media
www.argosmedia.nl
WB sites: vitiligo.nl, vanbetuwgrafischontwerp.nl, pauladudok.nl,ksi-advies.nl, maycroft.com, bakker-schilder.nl, bruschke.nl, bereikbaarheid.nl, nvpit.nl, kerncompany.nl, wijnenspijs.nl, almerehuren.nl
pcwacht
Guest
Re: Breadcrumb module
«
Reply #19 on:
September 18, 2005, 12:27:07 PM »
Maybe the if else need more structuring something like this:
Code:
<?php
if (
PAGE_ID
==
1
) {
breadcrumbs
(
PAGE_ID
);
} else {
echo
'<a href="http://someplacecalledhome">Home > </a>'
.
breadcrumbs
(
PAGE_ID
);
}
?>
The logic,
You need the home added to every page except for the homepage
This is what the test does,
if page equals homepage just show the breadcrumbs, if not, show home plus the breadcrumbs
It should work.
John
Logged
Pages:
[
1
]
2
Jump to:
Please select a destination:
-----------------------------
General
-----------------------------
=> Announcements
===> Security Announcements
=> Guest Area and Off-Topic
=> Website Showcase
-----------------------------
English
-----------------------------
=> Help/Support
===> Help/Support of WB2.7.x core
=> Website Baker Development
===> Website Baker 3
=> Documentation
=> Templates
=> Modules
===> Code Snippets
=> Languages
=> Archive
-----------------------------
Deutsch (German)
-----------------------------
=> Ankündigungen
=> Hilfe/Support
===> Templates, Module & Co.
===> Hilfe/Support von WB2.7.x core
=> Diskussion über WB
===> jQuery
=> Off-Topic
=> Archiv
-----------------------------
Nederlands (Dutch)
-----------------------------
=> Aankondigingen
=> Help / Support
===> WB Core
===> Templates, Modules & Languages
=> WB Discussie
=> Niet-Terzake (Off Topic)
-----------------------------
French
-----------------------------
=> Help/Support
-----------------------------
Italian
-----------------------------
=> Help/Support
Loading...