Results 1 to 7 of 7
  1. #1
    Join Date
    Oct 2006
    Location
    Alberta, Canada
    Posts
    4,571
    Plugin Contributions
    1

    Default ALT and TITLE with zen_image code

    Keeping in the spirit of the Override system I use the following code:

    <?php echo zen_image(DIR_WS_TEMPLATES . $template_dir . '/images/some_image.gif'); ?>

    Unfortunately, I cannot figure out how to also include a proper ALT tag and a TITLE tag.

    A Forum search revealed nothing quite like what I am trying to accomplish.

    Can anyone advise how to do that with the above code?

    Thanks

  2. #2
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: ALT and TITLE with zen_image code

    A small alteration, adding the ALT+TITLE text as the 2nd parameter will accomplish that:

    <?php echo zen_image(DIR_WS_TEMPLATES . $template_dir . '/images/some_image.gif', $text_for_Alt_and_Title_here); ?>

    You could use a variable as shown above, or a literal string inside quotes.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Oct 2006
    Location
    Alberta, Canada
    Posts
    4,571
    Plugin Contributions
    1

    Default Re: ALT and TITLE with zen_image code

    Call me dumb but I cannot figure out how to get either working.

    If I were to use a variable, where do I define it?
    Using a literal did not make any change?

    Could you provide an example?

    Appreciate the help.

  4. #4
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: ALT and TITLE with zen_image code

    This is the function definition line:

    /includes/functions/html_output.php

    Line #159 : function zen_image($src, $alt = '', $width = '', $height = '', $parameters = '') {

    I specify a title for an image with this, leaving alt, width and height as default:
    PHP Code:
    $cat_name_display zen_image(DIR_WS_TEMPLATE 'buttons/' $_SESSION['language'] . '/catimg' $current_path '.gif''''''''title="' $cat_name_display '"'); 

  5. #5
    Join Date
    Oct 2006
    Location
    Alberta, Canada
    Posts
    4,571
    Plugin Contributions
    1

    Default Re: ALT and TITLE with zen_image code

    Appreciate the feedback, Glenn.

    Using what you and DrByte provided allowed me to come up with:

    <?php echo zen_image(DIR_WS_TEMPLATES . $template_dir . '/images/shoppingcart.gif','Click to view Cart'); ?>

    Which results with the addition of: alt="Click to view Cart" title=" Click to view Cart "

  6. #6
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: ALT and TITLE with zen_image code

    Just a note for Glenn ... the zen_image() function sets BOTH the ALT and TITLE attributes to the value passed to the $alt parameter, so adding a title attribute to the $parameters option would potentially result in a double set of title attributes in the same img tag.

    What WebsiteRob has done is exactly what I had expected. :)
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  7. #7
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: ALT and TITLE with zen_image code

    I was actually looking to have just a title (for accessibility) and no hover alt text, but found that either way gave both results. Didn't want to complicate my response to Rob.

 

 

Similar Threads

  1. v154 zen_image: Why the extra spaces in the title= attribute?
    By lat9 in forum General Questions
    Replies: 8
    Last Post: 11 Sep 2019, 05:51 PM
  2. v150 How to set Title different as Alt for zen_image?
    By tips007 in forum General Questions
    Replies: 3
    Last Post: 29 Oct 2012, 08:44 PM
  3. Replies: 3
    Last Post: 30 Jul 2008, 04:17 PM
  4. Using 'title' and 'alt' for images and info
    By chufty bill in forum General Questions
    Replies: 5
    Last Post: 29 Oct 2006, 10:21 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg