News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

image title=

Started by marvays, October 26, 2020, 09:52:34 AM

Previous topic - Next topic

marvays

Hello. I have tempalte from olympiatheme deployed on the web selling bows and crossbows. And I need to get one thing out. For images, I want to display title = "" next to the alt attribute
Unfortunately, I can't figure out which files I need to search. I haven't been lucky yet. Can you please advise? I need to edit the code to display title = "" on images in categories, in the category and in the product detail. Thank you for your advice.

PRO

where at? product page? category page?

product page
default_images.php

marvays

Quote from: PRO on October 26, 2020, 18:41:35 PM
where at? product page? category page?

product page
default_images.php

in categories

pinochico

#3
Martine,

why you don't learn debug php code?
I'm not a developer, but after 3 years in company EasySoftware and now 4 years in Minion I know how find the right function.
You know php, then you can learn how debug code.
Good for debug is PHPStorm, but you can find in ftp in terminal very quickly.

If you need to add params title="XXX" to code <img.... >, then you must create hack for internal Joomla function "image" inside this file:

libraries/cms/html/html.php

or write your custom SEO plugin with override this function
or use of any SEO plugins for joomla - try to find on Google.

Or maybe you can try another way - with function replace in PHP inside sublayout "product.php"

You have a lot of variants, how you can walk to END/CÍL.


Add more info about title:
"title has a number of accessibility problems, mainly based around the fact that screen reader support is very unpredictable and most browsers won't show it unless you are hovering with a mouse (so e.g. no access to keyboard users)."

I think more important is adding height and weight for all pictures, than title :D

P.S.
My tutorials and answers are just a helping hand to finding your right way to go == they will never contain program code because I'm not a freelancer.
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

marvays

Thx.

Height and weight can JCH Optimise.

But, in category administration i can setup meta title. But this title vm cant show on categories page. I dnot know why? But I must go to ftp, find file, and change it.

PS: Sry for my bad english.

marvays

Hi all.
I need a simple code modification in the category listing . . .


<div class="category <?php echo $category_cellwidth ?>">
      <div class="thumbnail">
        <a href="<?php echo $caturl ?>" <?php echo $ajaxUpdate?> >
          <div class="text-center" data-mh="image-wrapper">
            <?php echo $category->images[0]->displayMediaThumb('class="browseCategoryImage"',false); ?>
          </div>
          <div class="caption text-center" data-mh="cat-name">
            <hr>
            <h2 class="vm-cat-title">
              <?php echo vmText::_($category->category_name?>
            </h2>
          </div>
        </a>
      </div>
    </div>


and need add to image categories title.


My suggestion is:

<div class="text-center" data-mh="image-wrapper">
     <?php echo $category->images[0]->displayMediaThumb('title="XXX" class="browseCategoryImage"',false); ?>
</div>


a místo xxx potřebuji zobrazit: <?php echo vmText::_($category->category_name) ?>

But those heads are spinning from those brackets :)

marvays

My first test dont work :)

<?php echo $category->images[0]->displayMediaThumb('title="'<?php echo vmText::_($category->category_name?>'" class="browseCategoryImage"',false); ?>

marvays

um, there's a mess in that system. All images are missing the title attribute. And the alt attribute is retrieved from the unknown. The development team are great programmers, but you would need an SEO speshitpillt to join the team :)

AH

QuoteAnd the alt attribute is retrieved from the unknown.

Or maybe it is created from the function displayMediaThumb in mediahandler.php

and then further in function displayIt(

However to help you out, maybe this should give you an idea of how to get what you want:


echo $category->images[0]->displayMediaThumb('title="'. vmText::_($category->category_name) .'" alt="'. vmText::_($category->category_name) .'" class="browseCategoryImage"',false);

Regards
A

Joomla 4.4.5
php 8.1

marvays

It works great. Thank you very much. God will repay you for your children :)

AH

Glad to know it worked for you  :)

Fortunately I am not seeking divine payments.
Regards
A

Joomla 4.4.5
php 8.1