marty.net 1001 Postcards Love Love Love Meep Meep ZenZodiac DailyQuotation

YOU ARE HERE:
Change breadcrumb store name

HOME

CPSHOP|

|

|

EMAIL MARTY
  marty.net message board
  « Change breadcrumb store name »
Welcome, Guest. Please Login or Register.
12/15/17 at 12:18:20
Home Help Search Login Register
   marty.net message board
   About cpshop
   Customization Help
   Change breadcrumb store name
(Moderator: Marty)
Pages: « 1 2 Reply Notify of replies Send the topic Print 
   Author  Topic: Change breadcrumb store name  (Read 2267 times)
KaptainMyke.com
Gold Dragon
****

Gender: male
Posts: 210



KaptainMyke.com , Inc.
   

WWW E-Mail
Re: Change breadcrumb store name
« Reply #15 on: 11/17/11 at 21:06:21 »
Reply with quote Modify message

You pretty much have to do it that way.  Also, if you rename titles or storeids you will have to go back and create/correct new variations of paths your site links go through.
Logged

Mike "KaptainMyke" Sorensen
www.kaptainmyke.com
KaptainMyke.com, Inc.
CEO
KaptainMyke.com
Gold Dragon
****

Gender: male
Posts: 210



KaptainMyke.com , Inc.
   

WWW E-Mail
Re: Change breadcrumb store name
« Reply #16 on: 11/18/11 at 16:20:14 »
Reply with quote Modify message

Be careful.  If you try to ditch all apostrophes in titles and products.  You will cause javascript errors.

This is safe:


Code:
   $pagetitle =~ s/'s/s/g;


This is NOT:


Code:
   $html =~ s/'//g;
Logged

Mike "KaptainMyke" Sorensen
www.kaptainmyke.com
KaptainMyke.com, Inc.
CEO
Hex Angel - Patrick
Gold Dragon
****

Posts: 500



Our nature lies in movement; complete calm is death.
   

WWW
Re: Change breadcrumb store name
« Reply #17 on: 11/19/11 at 18:36:46 »
Reply with quote Modify message

dmp65,

The format of uber long titles is

blah blah < yadda yadda < storename
blah blah < yadda yadda < drivel < storename
blah blah < yadda yadda < drivel < even more drivel < storename

assuming your separator character is '<'

you want to remove the yadda and drivel, which is everything between the first '<' and the last one.

something like this should do it for you.

$pagetitle =~ s/^(.*?)<.*<(.*?)$/$1 < $2/;

« Last Edit: 11/19/11 at 18:38:33 by Hex Angel - Patrick » Logged

CPSHOP
www.PeaceAndLoveShop.com Namaste
BLOG
www.TheNomadicSpirit.com Inspired by travel
www.GodBeautyPerfectionLove.com Inspired by spirit
www.MyMuseMoviesMusicAndBooks.com Inspired by the arts
dmp65
Gold Dragon
****

Posts: 57



Go Scots!
   

Re: Change breadcrumb store name
« Reply #18 on: 11/19/11 at 18:58:32 »
Reply with quote Modify message

Thanks Patrick. That's exactly what I'm trying to do. Unfoirtunately, I couldn't get that to work. Maybe I coded it wrong. Here's what I have:


Code:
$hacked = 1;

if ($hacked) {
&gettemplate;
    # dmp -- shorten page title
  $pagetitle =~ s/^(.*?)<.*<(.*?)$/$1 < $2/;
  $html =~ s/<\[title\]>/$pagetitle/g;
  $html =~ s/<\[content\]>/$content/;
   
  unless (@ARGV) {
      print "Content-Type: text/html\n\n";
  }
  print $html;
  exit;


} else {
   &gettemplate;
   $html =~ s/<\[title\]>/$pagetitle/g;
   $html =~ s/<\[breadcrumb\]>/$breadcrumb/g;
   $html =~ s/<\[content\]>/$content/;

   unless (@ARGV) {
       print "Content-Type: text/html\n\n";
   }
   print $html;
   exit;
}
Logged
Hex Angel - Patrick
Gold Dragon
****

Posts: 500



Our nature lies in movement; complete calm is death.
   

WWW
Re: Change breadcrumb store name
« Reply #19 on: 11/20/11 at 18:59:13 »
Reply with quote Modify message

Hmmmm.... think Marty is using "&lt;" rather than "<" so try changing that to this: "(<|&lt;)" which means "either < or &lt;"


Code:
   # dmp -- shorten page title
 $pagetitle =~ s/^(.*?)(<|&lt;).*(<|&lt;)(.*?)$/$1 < $4/;


Note: since we've added two more sets of parentheses to the search string the $2 in the replacement string is now a $4.

Logged

CPSHOP
www.PeaceAndLoveShop.com Namaste
BLOG
www.TheNomadicSpirit.com Inspired by travel
www.GodBeautyPerfectionLove.com Inspired by spirit
www.MyMuseMoviesMusicAndBooks.com Inspired by the arts
KaptainMyke.com
Gold Dragon
****

Gender: male
Posts: 210



KaptainMyke.com , Inc.
   

WWW E-Mail
Re: Change breadcrumb store name
« Reply #20 on: 11/20/11 at 19:01:13 »
Reply with quote Modify message

What are you guys talking about?  i am lost.
Logged

Mike "KaptainMyke" Sorensen
www.kaptainmyke.com
KaptainMyke.com, Inc.
CEO
Hex Angel - Patrick
Gold Dragon
****

Posts: 500



Our nature lies in movement; complete calm is death.
   

WWW
Re: Change breadcrumb store name
« Reply #21 on: 11/20/11 at 21:19:07 »
Reply with quote Modify message

Myke -- a posting that shows on page 1 of this thread:


on 10/12/11 at 21:45:39, herbbread wrote:
I was wondering if there was a way to change the store name for my breadcrumb trail.  For SEO reasons, the title for my pages is long: "Necessary and Sufficient Tees - Science and Gaming Shirts"

When the breadcrumb trail displays, it shows something like:

Necessary and Sufficient Tees - Science and Gaming Shirts > Neuroscience > Sleepy Serotonin

Is there a way to change the "store page name" without changing the title so that it looks something like:

Standard Collection > Neuroscience > Sleepy Serotonin
Logged

CPSHOP
www.PeaceAndLoveShop.com Namaste
BLOG
www.TheNomadicSpirit.com Inspired by travel
www.GodBeautyPerfectionLove.com Inspired by spirit
www.MyMuseMoviesMusicAndBooks.com Inspired by the arts
KaptainMyke.com
Gold Dragon
****

Gender: male
Posts: 210



KaptainMyke.com , Inc.
   

WWW E-Mail
Re: Change breadcrumb store name
« Reply #22 on: 11/20/11 at 21:30:59 »
Reply with quote Modify message

Right but u guys are using crazy characters and dollar signs and whatnot.
Logged

Mike "KaptainMyke" Sorensen
www.kaptainmyke.com
KaptainMyke.com, Inc.
CEO
dmp65
Gold Dragon
****

Posts: 57



Go Scots!
   

Re: Change breadcrumb store name
« Reply #23 on: 11/21/11 at 00:58:28 »
Reply with quote Modify message



on 11/20/11 at 18:59:13, Hex Angel - Patrick wrote:
Hmmmm.... think Marty is using "&lt;" rather than "<" so try changing that to this: "(<|&lt;)" which means "either < or &lt;"


Code:
   # dmp -- shorten page title
 $pagetitle =~ s/^(.*?)(<|&lt;).*(<|&lt;)(.*?)$/$1 < $4/;


Note: since we've added two more sets of parentheses to the search string the $2 in the replacement string is now a $4.


That worked! Patrick, you are amazing. I really appreciate your help with this.

Dave
Logged
Hex Angel - Patrick
Gold Dragon
****

Posts: 500



Our nature lies in movement; complete calm is death.
   

WWW
Re: Change breadcrumb store name
« Reply #24 on: 11/21/11 at 02:32:06 »
Reply with quote Modify message

Myke,

<grin> Yep!  

They're part of what's called a 'regular expression'.  Really, a more appropriate name would be 'arcane voodoo code', because until you really, really grok them, they seem anything but regular.

To learn more, Google 'perl regular expressions', 'perl string replacement' and 'perl string matching'.

They're a bit of a mind-twist. However, regular expressions and string replacement are also extremely powerful. I've only added about three lines of code to cppage.lib and cpdata.lib -- where cpshop does all it's stuff. Mostly I setup cpadmin.cgi, sortorder.txt and my templates to make cpshop generate output that isn't really HTML. Then I just do a lot more string replacement to $html and $content than we've been doing in this thread. <smile> A lot more.

« Last Edit: 11/21/11 at 02:33:08 by Hex Angel - Patrick » Logged

CPSHOP
www.PeaceAndLoveShop.com Namaste
BLOG
www.TheNomadicSpirit.com Inspired by travel
www.GodBeautyPerfectionLove.com Inspired by spirit
www.MyMuseMoviesMusicAndBooks.com Inspired by the arts
Hex Angel - Patrick
Gold Dragon
****

Posts: 500



Our nature lies in movement; complete calm is death.
   

WWW
Re: Change breadcrumb store name
« Reply #25 on: 11/21/11 at 02:39:32 »
Reply with quote Modify message

<smile> No worries, Dave.

lol -- at myself. To make 'proper' html, that really should be...


Code:
  # dmp -- shorten page title
$pagetitle =~ s/^(.*?)(<|&lt;).*(<|&lt;)(.*?)$/$1 &lt; $4/;


I get lazy, sometimes, and although it works anyway, you're not supposed to use '<' or '>' in HTML code.

Logged

CPSHOP
www.PeaceAndLoveShop.com Namaste
BLOG
www.TheNomadicSpirit.com Inspired by travel
www.GodBeautyPerfectionLove.com Inspired by spirit
www.MyMuseMoviesMusicAndBooks.com Inspired by the arts
Pages: « 1 2 Reply Notify of replies Send the topic Print 
Jump to:


marty.net message board (http://www.marty.net/cgi/marty/board/messageboard)

Powered by YaBB 1 Gold - Release (Yet Another Bulletin Board)
Copyright 2000-2001, X-Null. All Rights Reserved.