Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Images

Alt and title tag problems within php

images php coding issues or problems here.

Moderators: macek, egami, gesf

Alt and title tag problems within php

Postby Robot3 » Wed Feb 27, 2013 9:11 am

Hello.
I use Joomla, and from databese one component add pictures of games, but unfortunaly images do not show alt tag corect. :S
Hier is code.
Code: Select all
$db =& JFactory::getDBO();

  for($i=0;$i<count($this->games);$i++) {
    $game=$this->games[$i];
    $slug=$game->slug;

    $game->imgname=$this->params->get('dir_swf').$slug.'/'.$game->imgname;
    $game->description=$db->getEscaped($game->description);
    $game->description=str_replace("\\\"","\'",$game->description);
    $game->namett=$db->getEscaped($game->name);

   ?>


  <div class="game" style="text-align:center;">

   <a style="border:0;" href="<?php echo JRoute::_('index.php?option=com_yoflash&view=game&id='.$slug.'&Itemid='.$this->Itemid); ?>" onmouseover="Tip('<strong><?php echo $game->namett; ?></strong><br/> <?php echo $game->description; ?>',WIDTH,300,FADEIN,0,DELAY,0,BGCOLOR, '<?php echo $this->params->get('ttip_bgcolor'); ?>', BORDERCOLOR,'<?php echo $this->params->get('ttip_bordercolor'); ?>',FONTCOLOR,'<?php echo $this->params->get('ttip_fontcolor'); ?>',FONTSIZE,'<?php echo $this->params->get('ttip_fontsize'); ?>',FONTFACE,'<?php echo $this->params->get('ttip_fontface'); ?>')" onmouseout="UnTip()">

     <img src="<?php echo $game->imgname; ?>" width="100" height="100" alt="<?php echo $game->name; ?>"/><br/>
     <?php echo $game->name; ?>
    </a>

</div>


   <?php
  }

And this:
Code: Select all
<img src="<?php echo $game->imgname; ?>" width="100" height="100" alt="<?php echo $game->name; ?>"/><br/>
do not work corect. :S Alt tag shown empty. :S I tray to change alt="<?php echo $game->name; ?>" in to alt="<?php echo $game->namett; ?>" but then in alt tag are shown name of pictures, which most of time look weird, :S and not name of games. :S
Robot3
New php-forum User
New php-forum User
 
Posts: 2
Joined: Wed Feb 27, 2013 9:02 am

Return to PHP coding => Images

Who is online

Users browsing this forum: Baidu [Spider] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron