Home
Download
Add-ons
Help
Forum
Organisation
Project
Welcome,
Guest
. Please
login
or
register
.
March 20, 2010, 10:56:54 PM
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Search:
Advanced search
Wollen Sie dem Website Baker Team beitreten?
Nähere Informationen finden Sie unter
hier
und auf unserer
neuen Webseite
.
110556
Posts in
15966
Topics by
9310
Members
Latest Member:
stevenris10
WebsiteBaker Community Forum
English
Archive (posts up to 2007)
(Moderators:
Argos
,
BerndJM
)
Breadcrumb module
Pages:
[
1
]
2
Author
Topic: Breadcrumb module (Read 16820 times)
sucresemoule
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
Offline
Posts: 498
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
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
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
Offline
Posts: 498
Breadcrumb module
«
Reply #5 on:
April 18, 2005, 03:15:17 PM »
Thank you!! Great!
Hans
Logged
Hans - Nijmegen - The Netherlands
glenn
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
Offline
Posts: 31
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
Offline
Posts: 31
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
Forum administrator
Offline
Posts: 1348
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/portfolio
(mostly WB sites)
----------------------------------------------------------------
Please don't request personal support, use the forums!
Stefan
Guest
Re: Breadcrumb module
«
Reply #13 on:
September 15, 2005, 02:08:01 PM »
Just hardcode the part to the first '>'.
Logged
Argos
Forum administrator
Offline
Posts: 1348
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/portfolio
(mostly WB sites)
----------------------------------------------------------------
Please don't request personal support, use the forums!
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
Forum administrator
Offline
Posts: 1348
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/portfolio
(mostly WB sites)
----------------------------------------------------------------
Please don't request personal support, use the forums!
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
Forum administrator
Offline
Posts: 1348
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/portfolio
(mostly WB sites)
----------------------------------------------------------------
Please don't request personal support, use the forums!
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
Argos
Forum administrator
Offline
Posts: 1348
Re: Breadcrumb module
«
Reply #20 on:
September 19, 2005, 08:36:39 PM »
Eh... now it shows "home" AFTER the content of the breadcrumb.
So: item > subitem > home
Logged
Jurgen Nijhuis
Argos Media
www.argosmedia.nl/portfolio
(mostly WB sites)
----------------------------------------------------------------
Please don't request personal support, use the forums!
Argos
Forum administrator
Offline
Posts: 1348
Re: Breadcrumb module
«
Reply #21 on:
September 19, 2005, 08:48:29 PM »
Okay, I decided to fool around a bit and found that this works:
Quote
<?php
if (PAGE_ID==1) {
echo '<a href="
http://www.domain.com/wb/pages/home.php
">Home </a>';
} else {
echo '<a href="
http://www.domain.com/wb/pages/home.php
">Home</a> > '; breadcrumbs(PAGE_ID);
}
?>
Logged
Jurgen Nijhuis
Argos Media
www.argosmedia.nl/portfolio
(mostly WB sites)
----------------------------------------------------------------
Please don't request personal support, use the forums!
pcwacht
Guest
Re: Breadcrumb module
«
Reply #22 on:
September 19, 2005, 08:49:43 PM »
Kewl, nice job
Every job wich does the job is nice
John
Logged
Argos
Forum administrator
Offline
Posts: 1348
Re: Breadcrumb module
«
Reply #23 on:
September 19, 2005, 09:05:46 PM »
And after more fiddling around I found out how to create breadcrumbs with the Home in it, but without links. I actually needed that because I like the visual navigational aid of a breadcrumb, but since I only have 3 levels, with the middle one empty, I couldn't use a link to it. Anyway, it looks like this:
Quote
<?php
if (PAGE_ID==1) {
echo 'Home';
} else {
echo 'Home > '; breadcrumbs(PAGE_ID);
}
?>
And this line of the script in the header should be changed from:
Quote
echo '<a href="'.page_link($page['link']).'">'.$page['menu_title'].'</a>';
to:
Quote
echo $page['menu_title'];
Logged
Jurgen Nijhuis
Argos Media
www.argosmedia.nl/portfolio
(mostly WB sites)
----------------------------------------------------------------
Please don't request personal support, use the forums!
pcwacht
Guest
Re: Breadcrumb module
«
Reply #24 on:
September 19, 2005, 10:43:43 PM »
Don't you just love the snippets?
Logged
Pages:
[
1
]
2
Jump to:
Please select a destination:
-----------------------------
General
-----------------------------
=> General Announcements
=> Security Announcements
=> Documentation
=> Guest Area & Off-Topic
-----------------------------
English
-----------------------------
=> Help & Support
=> Modules
=> Droplets (PHP code for use with Droplet module) & Snippets (raw PHP code)
=> jQuery
=> Templates, Menus & Design
=> WebsiteBaker Language Files
=> WebsiteBaker 2.x discussion
=> WebsiteBaker 3
=> Archive (posts up to 2007)
-----------------------------
Deutsch (German)
-----------------------------
=> Ankündigungen
=> Hilfe/Support
=> Module & Snippets
=> Templates & Design
=> Tutorials
=> jQuery
=> Diskussion über WB
=> Off-Topic
=> Archiv für Themen bis 2007
-----------------------------
Nederlands (Dutch)
-----------------------------
=> Aankondigingen
=> Hulp & Ondersteuning
=> Niet-Terzake (Off Topic)
-----------------------------
Francais (French)
-----------------------------
=> Help/Support
-----------------------------
Italiano (Italian)
-----------------------------
=> Help/Support
Loading...