PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 25th, 2013, 02:54 PM
Robotower Robotower is offline
Contributing User
Click here for more information
 
Join Date: Oct 2012
Location: Croatia
Posts: 66 Robotower User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 h 58 m 54 sec
Reputation Power: 1
Joomla - Php alt tag in images dont work

Hello.
I use some components to instal games, flash games, and on web site their is a pictures of each games. But on pictures missing alt, and tittle tags. :S Tittle are not writed, but if know hav to insert tittle like alt tag, it would be great.
Hier is code for this:
PHP Code:
<?php
    
///////////////////////////////////////
    // DROPDOWN ORDER END
    ///////////////////////////////////////

    ///////////////////////////////////////
    // GAMES BOXES START
    ///////////////////////////////////////
  
$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 i get:
Code:
<a onmouseout="UnTip()" onmouseover="Tip('<strong>Alaska Jigsaw</strong><br/> Alaska Jigsaw are puzzle game in which you use the mouse to piece together few pictures of Alaska.',WIDTH,300,FADEIN,0,DELAY,0,BGCOLOR, '#E2E7FF', BORDERCOLOR,'#003099',FONTCOLOR,'#000044',FONTSIZE,'8pt',FONTFACE,'Verdana,Geneva,sans-serif')" href="/alaska-jigsaw.html" style="border:0;"><img width="100" height="100" alt="" src="/images/games/alaska-jigsaw/alaskajigsaw.jpg"></img><br></br>
      
     Alaska Jigsaw    
    </a></div>

As i can see all work, except this with alt tag,
this code
PHP Code:
 alt="<?php echo $game->name; ?>" 
give
Code:
alt=""
and this
PHP Code:
<?php echo $game->name?>
give name of games. Which i whant to be in alt tags too, but on this part dont work. :S Please help.
__________________
Internet games

Reply With Quote
  #2  
Old February 25th, 2013, 02:57 PM
ManiacDan's Avatar
ManiacDan ManiacDan is offline
Likely to be eaten by a grue.
Dev Shed God 10th Plane (9500 - 9999 posts)
 
Join Date: Oct 2006
Location: Pennsylvania, USA
Posts: 9,809 ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)  Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 2 Months 3 Weeks 18 h 6 m 48 sec
Reputation Power: 6112
Why not just use $game->namett? That seems to be working.

Also, your style is wrong. That's not how you do CSS styles at all.
__________________
HEY! YOU! Read the New User Guide and Forum Rules

"They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

"The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.

Reply With Quote
  #3  
Old February 25th, 2013, 03:28 PM
Robotower Robotower is offline
Contributing User
Click here for more information
 
Join Date: Oct 2012
Location: Croatia
Posts: 66 Robotower User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 h 58 m 54 sec
Reputation Power: 1
This is not my php code, i use from one components for adding games.
I tray to add $game->namett but then i dont name of games, i get images name. :S Which look somethin like this games_112921'12 and like this.I dont know haw code write name on the last sections great, and in alt="" same code do not work. :S What is this?

Reply With Quote
  #4  
Old February 25th, 2013, 03:55 PM
ManiacDan's Avatar
ManiacDan ManiacDan is offline
Likely to be eaten by a grue.
Dev Shed God 10th Plane (9500 - 9999 posts)
 
Join Date: Oct 2006
Location: Pennsylvania, USA
Posts: 9,809 ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)  Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 2 Months 3 Weeks 18 h 6 m 48 sec
Reputation Power: 6112
PHP Code:
 $game->namett=$db->getEscaped($game->name); 
That's how game->namett gets set. If you're saying it's an image name, you have more problems than i can fix with just this small snippet.

Reply With Quote
  #5  
Old February 26th, 2013, 02:49 AM
Robotower Robotower is offline
Contributing User
Click here for more information
 
Join Date: Oct 2012
Location: Croatia
Posts: 66 Robotower User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 h 58 m 54 sec
Reputation Power: 1
This should put name of games inside the alt tags in images, but it puts image names. :S Which sometimes look strange, and not seo friendly. I dont understand whay this code
PHP Code:
<?php echo $game->name?>
put game name, when are out from "", and inside alt="" dont write nothing. Did "" means somthing in php?

Reply With Quote
  #6  
Old February 27th, 2013, 05:54 AM
Robotower Robotower is offline
Contributing User
Click here for more information
 
Join Date: Oct 2012
Location: Croatia
Posts: 66 Robotower User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 h 58 m 54 sec
Reputation Power: 1
Quote:
Originally Posted by animation
a speaking navigation plugin for for Joomla! 1.5 allowing you to insert additional text to your menu items. Features list Nonspeaking you can set several parameters: * Tag: Choose which HTML tag is used to display text. Default.

What? I do not use Joomla 1.5, and what this have with no alt tag showing? I dont whant to insert aditional text in menu items, i whant to know whay code for showing some text do not work as it work on rest part.

Reply With Quote
  #7  
Old February 27th, 2013, 06:36 AM
Jacques1's Avatar
Jacques1 Jacques1 is offline
pollyanna
Click here for more information.
 
Join Date: Jul 2012
Location: Germany
Posts: 1,872 Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 2 Days 1 h 24 m 30 sec
Reputation Power: 813
You're talking to a spam bot. See the red "Warnings Level" and "Number of bans" in the top right corner? That's an indicator for spam.

Apart from that, this all doesn't make sense. So $game->name is something like "Alaska Jigsaw", but $db->getEscaped($game->name) suddenly returns the name of the image in the form "games_112921'12"??

Either you're totally mixing up the values, or your code is really, really broken. A database escaping function that magically turns names into file names doesn't work quite ... correctly.

I suggest two things:
  • Fix your code. Instead of having all kinds of unescaped and escaped values (which overwrite the unescaped attributes), leave the attributes as they are and escape them right before you echo them.
  • Make a var_dump() for each relevant value to check the content.

Reply With Quote
  #8  
Old February 27th, 2013, 07:05 AM
Robotower Robotower is offline
Contributing User
Click here for more information
 
Join Date: Oct 2012
Location: Croatia
Posts: 66 Robotower User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 h 58 m 54 sec
Reputation Power: 1
Quote:
Originally Posted by Jacques1
You're talking to a spam bot. See the red "Warnings Level" and "Number of bans" in the top right corner? That's an indicator for spam.

Apart from that, this all doesn't make sense. So $game->name is something like "Alaska Jigsaw", but $db->getEscaped($game->name) suddenly returns the name of the image in the form "games_112921'12"??

Either you're totally mixing up the values, or your code is really, really broken. A database escaping function that magically turns names into file names doesn't work quite ... correctly.

I suggest two things:
  • Fix your code. Instead of having all kinds of unescaped and escaped values (which overwrite the unescaped attributes), leave the attributes as they are and escape them right before you echo them.
  • Make a var_dump() for each relevant value to check the content.

First this is not my code, i use from another, and cand make sense in this, onlie little. But problem are that function
PHP Code:
<?php echo $game->name?>
write game names, which are ok, but in this part of code
PHP Code:
<img src="<?php echo $game->imgname; ?>" width="100" height="100" alt="<?php echo $game->name; ?>"/><br/>
     <?
php echo $game->name?> 
echo part for the name inside alt="" dont show anything. :S Whay this hapen? In one part show ok, in another part do not swow anything. :S

Reply With Quote
  #9  
Old February 27th, 2013, 07:30 AM
Jacques1's Avatar
Jacques1 Jacques1 is offline
pollyanna
Click here for more information.
 
Join Date: Jul 2012
Location: Germany
Posts: 1,872 Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 2 Days 1 h 24 m 30 sec
Reputation Power: 813
I understand your problem, you explained it already.

You have two options: You can keep wondering why this strange behaviour occurs and wait for somebody to come up with the magical explanation -- which will probably never happen. Or you can start investigating the problem.

Like I said, make a var_dump() of $game->name before the HTML stuff. What does the attribute contain? Also try replacing the alt="echo ..." with some hard coded string (echo 'Test' or something like that).

You know, try out different things. That's exactly what we do. We don't have any "magical powers" to find your bugs or something.

Reply With Quote
  #10  
Old February 27th, 2013, 07:55 AM
Robotower Robotower is offline
Contributing User
Click here for more information
 
Join Date: Oct 2012
Location: Croatia
Posts: 66 Robotower User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 h 58 m 54 sec
Reputation Power: 1
Can you write exact what i need to do?
Steps by steps. :S My php knowladge are very little. :/

Reply With Quote
  #11  
Old February 27th, 2013, 03:38 PM
Jacques1's Avatar
Jacques1 Jacques1 is offline
pollyanna
Click here for more information.
 
Join Date: Jul 2012
Location: Germany
Posts: 1,872 Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 2 Days 1 h 24 m 30 sec
Reputation Power: 813
You know the var_dump function, right? I'm saying that you should use it to check the content of your variables. Like this, for example:
PHP Code:
 var_dump($game->name); 

This will tell you the exact content of the name attribute, so that we no longer have to speculate about it.

Do that and post the exact output here:
PHP Code:
echo 'Testing: name, namett:<br>';
var_dump($game->name);
var_dump($game->namett);
echo 
'end of Testing.<br>'

Reply With Quote
  #12  
Old February 27th, 2013, 03:50 PM
Robotower Robotower is offline
Contributing User
Click here for more information
 
Join Date: Oct 2012
Location: Croatia
Posts: 66 Robotower User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 h 58 m 54 sec
Reputation Power: 1
string 'MINIBOT XP' (length=10)

Testing: name, namett:

string 'MINIBOT XP' (length=10)

string 'MINIBOT XP' (length=10)

end of Testing.

Reply With Quote
  #13  
Old February 27th, 2013, 06:56 PM
Jacques1's Avatar
Jacques1 Jacques1 is offline
pollyanna
Click here for more information.
 
Join Date: Jul 2012
Location: Germany
Posts: 1,872 Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 2 Days 1 h 24 m 30 sec
Reputation Power: 813
Thanks.

But this clearly shows that namett is not an image name as you claimed earlier. So obviously you're confusing the different variables and attributes. Use namett in the alt attribute, because that's actually the correct (escaped) value.

If it still doesn't work, echo a constant string in the alt attribute:
PHP Code:
 alt="<?php echo 'foobar'; ?>" 

Does that work?

Reply With Quote
  #14  
Old February 28th, 2013, 02:15 AM
Robotower Robotower is offline
Contributing User
Click here for more information
 
Join Date: Oct 2012
Location: Croatia
Posts: 66 Robotower User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 h 58 m 54 sec
Reputation Power: 1
Quote:
Originally Posted by Jacques1
Thanks.

But this clearly shows that namett is not an image name as you claimed earlier. So obviously you're confusing the different variables and attributes. Use namett in the alt attribute, because that's actually the correct (escaped) value.

If it still doesn't work, echo a constant string in the alt attribute:
PHP Code:
 alt="<?php echo 'foobar'; ?>" 

Does that work?

I do not say namett are variables of images name. :S But in alt tag variables namett give name of images, not of game. :S So somthing must be wrong with sytax or something, i tray to find on web, but their in alt tag use another sintax. :S

Reply With Quote
  #15  
Old February 28th, 2013, 02:23 AM
Robotower Robotower is offline
Contributing User
Click here for more information
 
Join Date: Oct 2012
Location: Croatia
Posts: 66 Robotower User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 h 58 m 54 sec
Reputation Power: 1
Ovo s foobarom ne radi.
Probao sam to staviti, copy paste. Ne izbacuje mi ništa.Ali kada kopiram izvan img polja, ispiše mi foobar. Znaći mora biti neka zeka s img tagom. :S

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Joomla - Php alt tag in images dont work

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap