Jan K. van Dalen
|
| Posted: 07/23/2008, 10:04 AM |
|
Anyone has written a template for breadcrumb?
Any ideas how to implement them on CCS other than hardcoded?
Thanks.
|
|
|
 |
ReneS
Posts: 225
|
| Posted: 07/23/2008, 11:04 AM |
|
Hi,
Is breadcrumb the same thing as the directory builder produces?
for example: Home > Products > Shoes ?
Then you can use the directory builder...
Rene
|
 |
 |
datadoit
|
| Posted: 07/23/2008, 2:08 PM |
|
Try this nine-step program to breadcrumbs utopia... :)
1. The breadcrumbs will be in an includable page, so you can drop it
into whatever page you want a history in. So create an includable page,
and just put five CCS labels into it (Forms -> Add Label). Switching to
HTML view, make sure it looks like (minus the code tags!):
<code>
<div id="bread">
<ul>
{Label1}{Label2}{Label3}{Label4}{Label5}
</ul>
</div>
</code>
2. In BeforeShow for {Label1}, Add Custom Code:
<code>
if (CCGetSession("Page1Link") !== "") {
$Component->SetValue("<li><a href='".CCGetSession("Page1Link")."'
target='_parent'>".CCGetSession("Page1Display")."</a>");
}
else {
$Component->Visible = false;
}
</code>
3. In BeforeShow for {Label2}, Add Custom Code:
<code>
if (CCGetSession("Page2Link") !== "") {
$Component->SetValue("<ul><li>» <a
href='".CCGetSession("Page2Link")."'
target='_parent'>".CCGetSession("Page2Display")."</a>");
}
else {
$Component->Visible = false;
}
</code>
4. In BeforeShow for {Label3}, Add Custom Code:
<code>
if (CCGetSession("Page3Link") !== "") {
$Component->SetValue("<ul><li>» <a
href='".CCGetSession("Page3Link")."'
target='_parent'>".CCGetSession("Page3Display")."</a>");
}
else {
$Component->Visible = false;
}
</code>
5. In BeforeShow for {Label4}, Add Custom Code:
<code>
if (CCGetSession("Page4Link") !== "") {
$Component->SetValue("<ul><li>» <a
href='".CCGetSession("Page4Link")."'
target='_parent'>".CCGetSession("Page4Display")."</a>");
}
else {
$Component->Visible = false;
}
</code>
6. In BeforeShow for {Label5}, Add Custom Code:
<code>
$Component->SetValue("<ul><li class='first'>»
".CCGetSession("Page5Display")."</li></ul></li></ul></li></ul></li></ul></li>");
</code>
That's all needed for the includable page.
7. Add the following to your Common.php file, or your own functions file
that is called by all pages:
<code>
//Function to keep track of the last five pages visited by the user.
function History($Link,$Display) {
//We don't EVER want the ccsForm parameter in our links!
$Link = CCRemoveParam($Link, "ccsForm");
//If the page didn't change, then don't do anything!
if ($Link !== CCGetSession("Page5Link")) {
CCSetSession("Page1Link", CCGetSession("Page2Link"));
CCSetSession("Page1Display", CCGetSession("Page2Display"));
CCSetSession("Page2Link", CCGetSession("Page3Link"));
CCSetSession("Page2Display", CCGetSession("Page3Display"));
CCSetSession("Page3Link", CCGetSession("Page4Link"));
CCSetSession("Page3Display", CCGetSession("Page4Display"));
CCSetSession("Page4Link", CCGetSession("Page5Link"));
CCSetSession("Page4Display", CCGetSession("Page5Display"));
CCSetSession("Page5Link", $Link);
CCSetSession("Page5Display", $Display);
}
} //End of function History().
</code>
8. Add the following style information where appropriate:
<code>
/* This breadcrumbs style comes from http://www.alistapart.com/articles/taminglists/. */
#bread {
color: #ccc;
background-color: #006;
padding: 3px;
margin-bottom: 0px;
}
#bread ul {
margin-left: 0;
padding-left: 0;
display: inline;
border: none;
}
#bread ul li {
margin-left: 0;
padding-left: 2px;
border: none;
list-style: none;
display: inline;
}
</code>
9. Finally, in every page where you want to include the breadcrumbs or
history, in the Page's After Initialize event, Add Custom Code:
<code>
//Set up variables for the History function, which keeps track of the
last five pages visited.
$Link =
"../index.php?module=applications&left=applications_leftframe.php&right=no&ret_link=applications_mainframe_detail.php";
if (CCGetQueryString("QueryString","") !== "") {
$Link .= "&" . CCGetQueryString("QueryString","");
}
$Display = "Application Detail";
History($Link,$Display);
</code>
Of course, update the $Link and $Display values with your own information.
I think that's it. Basically the history is kept in 10 session
variables (one for the link, and one for the display value). The
breadcrumbs themselves are displayed as links in the unordered list style.
|
|
|
 |
Jan K. van Dalen
|
| Posted: 07/23/2008, 10:17 PM |
|
Datadoit ... this is great ... thanks.
"datadoit" <datadoit@forum.codecharge> wrote in message
news:g686ku$eoq$1@news.codecharge.com...
> Try this nine-step program to breadcrumbs utopia... :)
>
> 1. The breadcrumbs will be in an includable page, so you can drop it into
> whatever page you want a history in. So create an includable page, and
> just put five CCS labels into it (Forms -> Add Label). Switching to HTML
> view, make sure it looks like (minus the code tags!):
>
> <code>
> <div id="bread">
> <ul>
> {Label1}{Label2}{Label3}{Label4}{Label5}
> </ul>
> </div>
> </code>
>
> 2. In BeforeShow for {Label1}, Add Custom Code:
>
> <code>
> if (CCGetSession("Page1Link") !== "") {
> $Component->SetValue("<li><a href='".CCGetSession("Page1Link")."'
> target='_parent'>".CCGetSession("Page1Display")."</a>");
> }
> else {
> $Component->Visible = false;
> }
> </code>
>
> 3. In BeforeShow for {Label2}, Add Custom Code:
>
> <code>
> if (CCGetSession("Page2Link") !== "") {
> $Component->SetValue("<ul><li>» <a
> href='".CCGetSession("Page2Link")."'
> target='_parent'>".CCGetSession("Page2Display")."</a>");
> }
> else {
> $Component->Visible = false;
> }
> </code>
>
> 4. In BeforeShow for {Label3}, Add Custom Code:
>
> <code>
> if (CCGetSession("Page3Link") !== "") {
> $Component->SetValue("<ul><li>» <a
> href='".CCGetSession("Page3Link")."'
> target='_parent'>".CCGetSession("Page3Display")."</a>");
> }
> else {
> $Component->Visible = false;
> }
> </code>
>
> 5. In BeforeShow for {Label4}, Add Custom Code:
>
> <code>
> if (CCGetSession("Page4Link") !== "") {
> $Component->SetValue("<ul><li>» <a
> href='".CCGetSession("Page4Link")."'
> target='_parent'>".CCGetSession("Page4Display")."</a>");
> }
> else {
> $Component->Visible = false;
> }
> </code>
>
> 6. In BeforeShow for {Label5}, Add Custom Code:
>
> <code>
> $Component->SetValue("<ul><li class='first'>»
> ".CCGetSession("Page5Display")."</li></ul></li></ul></li></ul></li></ul></li>");
> </code>
>
> That's all needed for the includable page.
>
> 7. Add the following to your Common.php file, or your own functions file
> that is called by all pages:
>
> <code>
> //Function to keep track of the last five pages visited by the user.
> function History($Link,$Display) {
>
> //We don't EVER want the ccsForm parameter in our links!
> $Link = CCRemoveParam($Link, "ccsForm");
>
> //If the page didn't change, then don't do anything!
> if ($Link !== CCGetSession("Page5Link")) {
> CCSetSession("Page1Link", CCGetSession("Page2Link"));
> CCSetSession("Page1Display", CCGetSession("Page2Display"));
> CCSetSession("Page2Link", CCGetSession("Page3Link"));
> CCSetSession("Page2Display", CCGetSession("Page3Display"));
> CCSetSession("Page3Link", CCGetSession("Page4Link"));
> CCSetSession("Page3Display", CCGetSession("Page4Display"));
> CCSetSession("Page4Link", CCGetSession("Page5Link"));
> CCSetSession("Page4Display", CCGetSession("Page5Display"));
> CCSetSession("Page5Link", $Link);
> CCSetSession("Page5Display", $Display);
> }
>
> } //End of function History().
> </code>
>
> 8. Add the following style information where appropriate:
>
> <code>
> /* This breadcrumbs style comes from
> http://www.alistapart.com/articles/taminglists/. */
> #bread {
> color: #ccc;
> background-color: #006;
> padding: 3px;
> margin-bottom: 0px;
> }
>
> #bread ul {
> margin-left: 0;
> padding-left: 0;
> display: inline;
> border: none;
> }
>
> #bread ul li {
> margin-left: 0;
> padding-left: 2px;
> border: none;
> list-style: none;
> display: inline;
> }
> </code>
>
> 9. Finally, in every page where you want to include the breadcrumbs or
> history, in the Page's After Initialize event, Add Custom Code:
>
> <code>
> //Set up variables for the History function, which keeps track of the last
> five pages visited.
> $Link =
> "../index.php?module=applications&left=applications_leftframe.php&right=no&ret_link=applications_mainframe_detail.php";
> if (CCGetQueryString("QueryString","") !== "") {
> $Link .= "&" . CCGetQueryString("QueryString","");
> }
> $Display = "Application Detail";
> History($Link,$Display);
> </code>
>
> Of course, update the $Link and $Display values with your own information.
>
> I think that's it. Basically the history is kept in 10 session variables
> (one for the link, and one for the display value). The breadcrumbs
> themselves are displayed as links in the unordered list style.
|
|
|
 |
paulmason411
Posts: 127
|
| Posted: 10/23/2008, 10:51 PM |
|
Just curious if it will work in this situation.
Say you have a menu with 3 Categories A, B, C, you then perform the following
- Click category A
- Click subcategory A1
- Click item A1X
Breadcrumb output links: category A > subcategory A1
- Click category B
- Click subcategory B1
- Click item B1X
Breadcrumb output links: category A > subcategory A1 > item A1X > category B > subcategory B1
Desired Output: category B > subcategory B1
Also if you have an expandable menu and you click a subcategory will it generate the parent category in the breadcrumb?
_________________
http://paulmason.name - Web Development Blog
|
 |
 |
kirchaj
Posts: 215
|
| Posted: 12/10/2008, 9:35 AM |
|
First, Datadoit, thank you for the very detailed and easy to follow instructions included here. Even I could follow them.
Second, Help! I have followed the steps but need a little help. I don't quite understand step nine and what I should do for my situation. I gave it my best effort and when I view the page I see the following
<ul><li class='first'>»Admin Main</li></ul></li></ul></li></ul></li></ul></li>
This solution would solve a large problem for me (dynamically not static) but I could use a little more help.
Thanks for all you do.
TK
|
 |
 |
datadoit
|
| Posted: 12/10/2008, 11:05 AM |
|
Change the label type to HTML from Text. That should fix it.
|
|
|
 |
|