Enabling the Built-In Breadcrumbs


Breadcrumbs are a set of links to parent sections. This is a great way to let customers know where they are in your site and provide an easy way to backtrack to parent sections. The new Yahoo! Store Editor has the breadcrumbs feature built into it. This might come as a surprise, and, no wonder: No switch or variable in the editor lets you enable breadcrumbs. This is part of the body-switch template, as shown here:

Body-switch. (wid) MULTI    IF test @show-path.      then MULTI              TEXT "[ "             WITH-LINK TO :index               TEXT "Home"             TEXT " > "             CALL :walk-up.              TEXT @name             TEXT " ]"             LINEBREAK number 2      else nil   IF test EQUALS value1 @type                   value2 :search.      then CALL :search-body.              wid      else CALL :page-body.              wid 


In this template, if the variable show-path. is TRue, breadcrumbs will show up at the top of the page. The problem is, there is no variable or property called show-path. Let's create a custom variable by that name. However, notice that the variable in this template has a period at the end of its name. Because periods are not allowed in custom variables, you cannot add show-path. You can, however, modify the copy of this template. To turn on the built-in breadcrumbs, all you have to do is modify your copy of the body-switch template and change @show-path. to up. The template should then look like this:

MULTI   IF test up      then MULTI             TEXT "[ "             WITH-LINK TO :index               TEXT "Home"             TEXT " > "             CALL :yourstoreid-walk-up.             TEXT @name             TEXT " ]"             LINEBREAK number 2      else nil   IF test EQUALS value1 @type                   value2 :search.      then CALL :yourstoreid-search-body.             wid      else CALL :yourstoreid-page-body.             wid 


This makes sense because you want to show breadcrumbs only for pages that have parents (where up has a value). With this template modification, you get breadcrumbs that look something like those in Figure 7.1.

Figure 7.1. Breadcrumbs.


A couple of problems crop up with this: First, the font is the default browser font (Times New Roman, in this case). Second, the font is too big; breadcrumbs are usually smaller than the regular text font. To rectify this, first replace the second MULTI expression with a FONT, and paste that MULTI expression within the FONT operator:

MULTI   IF test up      then FONT size 1                face @text-font             MULTI                TEXT "[ "               WITH-LINK TO :index                 TEXT "Home"               TEXT " > "               CALL :yourstoreid-walk-up                TEXT @name               TEXT " ]"               LINEBREAK number 2      else nil   IF test EQUALS value1 @type                  value2 :search.      then CALL :yourstoreid-search-body              wid     else CALL :yourstoreid-page-body             wid 


This is better, but the links between the home page and the current page are still too large. To fix that, edit your copy of the walk-up template. Originally, it looks like this:

yourstoreid-walk-up () FOR-EACH-OBJECT GET-PATH-TO dst id                                src :index                                nodst :t                                nosrc :t   WITH-LINK TO id     FONT size @text-size          face @text-font       TEXT @name   FONT size @text-size        face @text-font     TEXT " > " 


As you can see, FONT is set again in this template, so you have two choices:

  1. Edit each FONT operator in this template and change size to 1.

  2. Better yet, remove the FONT operators altogether.

This is what the finished template should look like:

Yourstoreid-walk-up () FOR-EACH-OBJECT GET-PATH-TO dst id                                src :index                                nodst :t                                nosrc :t   WITH-LINK TO id     TEXT @name   TEXT " > " 





Succeeding At Your Yahoo! Business
Succeeding At Your Yahoo! Business
ISBN: 0789735342
EAN: 2147483647
Year: N/A
Pages: 208

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net