noob - adding style to href

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
alek3tt
Forum Newbie
Posts: 2
Joined: Tue Mar 30, 2010 7:10 pm

noob - adding style to href

Post by alek3tt »

this is one line from script

Code: Select all

$gallery.= "<a href=\"".$directory.$file."\" rel=\"lightbox[".$galname."]\"><img src=\"".$thumbdirectory.$file."\" alt=\"\"></a>\n";

I would like to add style other than a{...} in external css file, so I tought I can add span class but it's not working (syntax error)

Code: Select all

$gallery.= "<span class="thumb_links"><a href=\"".$directory.$file."\" rel=\"lightbox[".$galname."]\"><img src=\"".$thumbdirectory.$file."\" alt=\"\"></a></span>\n";
is there some way to add css class or id to this link?
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: noob - adding style to href

Post by Benjamin »

alek3tt wrote:

Code: Select all

$gallery.= "<span class=\"thumb_links\"><a href=\"".$directory.$file."\" rel=\"lightbox[".$galname."]\"><img src=\"".$thumbdirectory.$file."\" alt=\"\"></a></span>\n";
Since the string is encapsulated using double quotes, you need to escape any double quotes in the string with a backslash.
alek3tt
Forum Newbie
Posts: 2
Joined: Tue Mar 30, 2010 7:10 pm

Re: noob - adding style to href

Post by alek3tt »

tnx, it works
Post Reply