Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

alt and title for images 03 Aug 2014 12:45 #12566

in my component i've an image called "logo"
in component builder I selected to use Item title (field "Nazwa firmy") as an image title and image alt



but unfortunately in may component frontend an alt and title attribut are missing,

code generatet in frontend
<div class="controls">
    <div style="width:px;height:px; overflow:hidden;display:inline-block;" class="img-zone">
        <img style="" src="/sandbox/cms25/index.php?option=com_demo11407&amp;task=file&amp;size=195x145&amp;attrs=center,format:png&amp;path=[DIR_FIRMY_LOGO]/alf-2.png">
    </div>	
</div>

and the size of img-zone div i empty - the inline style

How can I solve this problem?

I use Joomla 2.5

Please Log in or Create an account to join the conversation.

Last edit: by VentoStudio.

alt and title for images 05 Aug 2014 14:27 #12573

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
I have fixed this.
But for the moment it is not in the builder.
You might upgrade manually JDom in your libraries folder
libraries/jdom/html/fly/file/image.php

Here is the fixed file of JDom :
github.com/Cook-Self-Service/JDom/blob/m...l/fly/file/image.php

Hope it helps...
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

alt and title for images 05 Aug 2014 17:06 #12576

I managed to solve it in another way,

This is the original code from the generator:
<?php echo JDom::_('html.fly.file', array(
	'altKey' => 'alias',
	'attrs' => array('center','format:png'),
	'dataKey' => 'logo',
	'dataObject' => $row,
	'height' => 145,
	'indirect' => true,
	'root' => '[DIR_FIRMY_LOGO]',
	'route' => array('view' => 'firma','layout' => 'wizytowka','cid[]' => $row->id),
	'titleKey' => 'nazwa_firmy',
	'tooltip' => true,
	'width' => 195
));?>


and after modification:
<?php echo JDom::_('html.fly.file', array(
	'alt' => 'alias',
	'attrs' => array('center','format:png'),
	'dataKey' => 'logo',
	'dataObject' => $row,
	'height' => 145,
	'indirect' => true,
	'root' => '[DIR_FIRMY_LOGO]',
	'route' => array('view' => 'firma','layout' => 'wizytowka','cid[]' => $row->id),
	'title' => 'nazwa_firmy',
	'tooltip' => true,
	'width' => 195
));?>

Here is what has been modified:

'altKey' => 'alias',
to
'alt' => 'alias',

and
'titleKey' => 'nazwa_firmy',
to
'title' => 'nazwa_firmy',

and it also works :-)

Please Log in or Create an account to join the conversation.

Last edit: by VentoStudio.

alt and title for images 05 Aug 2014 19:59 #12577

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
This is strange.

You should eventualy can use :
<?php echo JDom::_('html.fly.file', array(
	'alt' => $row->alias,
	'title' => $row->nazwa_firmy,
));?>

But it is strange that it works as you say...

Note that the extra feature using the key, is that you can concat easily. For instance:
<?php echo JDom::_('html.fly.file', array(
	'altKey' => '{nazwa_firmy} - {alias}',
	'titleKey' => '{nazwa_firmy} - {alias}',
));?>
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.107 seconds

Although I found this tool some time ago I just started learning experimenting and building this first component on Monday and now on Thursday afternoon it's already online. Although I already had a working version done with another tool this is much easier to build and at the end you have the freedom to own your own component. Once you know how to use Cook you will boost your productivity as the learning curve is really moderate compared to many other tools.
Giori (Forum)

Get Started