Im listing files in a directory on a web page with links to the files.
I'm trying to change the link color to something other than my typical.
Below is the php link...

<?php
echo("<a href=  '$dirname/$file'>$file </a> ");echo "<br />";

?>

I want to change the class.
Below is one of many attempts...

<?php
$class22 = 'class="otherA"'; 
echo "<a href=\"" . "$dirname$file>$file" . "\"" .$class22. "\">";

I can't seem to get it right.
Any ideas?
Thanks

<?php
$class22 = 'class="otherA"'; 
echo "<a href=\"" . "$dirname$file>$file" . "\"" .$class22. "\">";

If $dirname = "blaat/", $file="somefile.jpg" and $class22='class="otherA"' then the outcome of your code would be:

<a href="blaat/somefile.jpg">somefile.jpg"class="otherA"">;

Perhaps you should try this:

$class22 = 'class="otherA"'; 
echo "<a href=\"" . $dirname . $file ."\" ".$class22.">".$file."</a>";

Thank you very much!
That did the trick.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.