0

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

2
Contributors
2
Replies
4
Views
7 Years
Discussion Span
Last Post by mark2326l
0
<?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>";
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.