Announcement

Collapse
No announcement yet.

Capitalizing lower case words for page title

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Capitalizing lower case words for page title

    All my category and product names are input in lower case only, and that's how we want them to display throughout the store.

    I would, however, like to display the category and product names with initial capital letters in the title field on my PROD and CTGY pages.

    Here's how the title tag is written on my PROD page.

    Code:
    <title>&mvte:product:name; | &mvt:store:name;</title>
    I would really like to transform &mvte:product:name; to display so the first letter of each word in the string is capitalized. It's a simple function in PHP, but I can't find something similar in Miva. Any ideas how I could do this?
    Todd Gibson
    Oliver + S | Sewing Patterns for Kids and the Whole Family

    #2
    Re: Capitalizing lower case words for page title

    Well if it was body text - it would be:

    CSS

    text-transform: capitalize;

    But for a page title...probably not
    Last edited by lesliekirk; 06-11-14, 09:59 AM.
    Leslie Kirk
    Miva Certified Developer
    Miva Merchant Specialist since 1997
    Previously of Webs Your Way
    (aka Leslie Nord leslienord)

    Email me: [email protected]
    www.lesliekirk.com

    Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

    Comment


      #3
      Re: Capitalizing lower case words for page title

      There are built in engine functions which will do all uppercase or all lowercase but not one which does sentence case.

      The just wrote some code below which should help do what you need. You'll need to tweak it slightly to pass in the product name.

      Code:
        <mvt:assign name="l.settings:product:name" value="'this is a sample product name'" />
      
      
        <mvt:assign name="g.counter" value="1" />
        <mvt:assign name="l.settings:word" value="gettoken( l.settings:product:name, asciichar(32), g.counter )" />
      
      
        <mvt:while expr="NOT ISNULL l.settings:word">
       
              <mvt:assign name="g.first_character" value="toupper( substring( l.settings:word,1,1 ) )" />
              <mvt:assign name="g.updated_word" value="g.first_character $ substring( l.settings:word,2,len(l.settings:word) )" />
            
      
      
            <mvt:assign name="g.counter" value="g.counter + 1" />
            <mvt:assign name="l.settings:word" value="gettoken( l.settings:product:name, asciichar(32), g.counter )" />
       
             <mvt:assign name="g.modified_name" value="g.modified_name $ g.updated_word $ ' ' " />        
        </mvt:while>
       
       <mvt:comment>Strip Trailing Space</mvt:comment>
      <mvt:assign name="g.modified_name" value="substring(g.modified_name,1,len(g.modified_name)-1)" />
      
      
      &mvt:global:modified_name;
      Brennan Heyde
      VP Product
      Miva, Inc.
      [email protected]
      https://www.miva.com

      Comment


        #4
        Re: Capitalizing lower case words for page title

        Brennan,

        Thanks so much! That did the trick. Perfect!

        Todd
        Todd Gibson
        Oliver + S | Sewing Patterns for Kids and the Whole Family

        Comment


          #5
          Re: Capitalizing lower case words for page title

          Thanks Leslie, this style: text-transform: capitalize; works in my shipment confirmation email for the bill to first name.
          Larry
          Luce Kanun Web Design
          www.facebook.com/wajake41
          www.plus.google.com/116415026668025242914/posts?hl=en


          Comment


            #6
            Re: Capitalizing lower case words for page title

            Oops, spoke too soon, Outlook does not process text-transform: capitalize; i.e. first letter isn't capitalized in Outlook :(

            We chose to go with Brennan's routine which is working great for us. Capitalizes all words in first name, very nice!
            We first use the Miva function tolower just in case the customer is using caps which is quite frequent.

            We've combined our customer invoice with the shipping notification. Got a page break to work between the two pages in Outlook using this mumbo jumbo:
            <!-- for Outlook emails -->
            <!--[if gte mso 9]>
            <span style='font-size:14.0pt;line-height:115%;font-family:"Calibri","sans-serif";
            mso-ascii-theme-font:minor-latin;mso-fareast-font-family:Calibri;mso-fareast-theme-font:
            minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:"Times New Roman";
            mso-bidi-theme-font:minor-bidi;mso-ansi-language:EN-US;mso-fareast-language:
            EN-US;mso-bidi-language:AR-SA'><br clear=all style='mso-special-character:line-break;
            page-break-before:always'>
            </span>
            <p class=MsoNormal><o:p>&nbsp;</o:p></p>
            <![endif]-->

            <p style="page-break-after:always;"></p> seems to work for the other email programs including Windows Live Mail:

            Brennan, thanks for that routine, saved us a lot of work and it makes our shipment email salutation look professional.

            Cheers, Larry
            Last edited by wajake41; 08-28-15, 07:28 PM.
            Larry
            Luce Kanun Web Design
            www.facebook.com/wajake41
            www.plus.google.com/116415026668025242914/posts?hl=en


            Comment


              #7
              Re: Capitalizing lower case words for page title

              FYI: There is no reason you couldn't use Text-transform in the head area of the page

              title { text-transform:capitolize }


              Heck, you can put anything in the head...css doesn't care (and neither do some browsers). This works

              <head>
              <div class="wowThisIsStupid">Hey, here's some crazy text</div>
              </head>
              Bruce Golub
              Phosphor Media - "Your Success is our Business"

              Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
              phosphormedia.com

              Comment

              Working...
              X