Problem modify an echo "<a href=\"", newbie in php?

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
Chacapamac
Forum Newbie
Posts: 5
Joined: Fri Nov 14, 2008 3:33 am

Problem modify an echo "<a href=\"", newbie in php?

Post by Chacapamac »

I have a code:

Code: Select all

echo "<a href=\"" . sefRelToAbs($indexalphacontent) . "\" style=\"font-weight:" . $ac_weighttitleindex . ";font-size:" . $ac_sizetitleindex."px\">" . $directoryname . "</a>";
I want to take away the ability in the code to control the appearance of the font (font-weight and size) add a css class of my own in there to be able to controle the font appearance by css...

Do you see any problem doing so?

First post Here.

Hello! everybody :D
Paul Arnold
Forum Contributor
Posts: 141
Joined: Fri Jun 13, 2008 10:09 am
Location: Newcastle Upon Tyne

Re: Problem modify an echo "<a href=\"", newbie in php?

Post by Paul Arnold »

You'll find it a lot easier using ' instead of " to display your blocks of html code.

Eg:

Code: Select all

 
echo '<a href="' . sefRelToAbs($indexalphacontent) . '" style="font-weight:' . $ac_weighttitleindex . ';font-size:' . $ac_sizetitleindex.'px">' . $directoryname . '</a>';
 
Also, you might be better off using PHP to select a certain CSS class rather than using inline CSS properties as you have in your example but I'd need to know more about how you intend it to work.
Chacapamac
Forum Newbie
Posts: 5
Joined: Fri Nov 14, 2008 3:33 am

Re: Problem modify an echo "<a href=\"", newbie in php?

Post by Chacapamac »

I want to just add a class to the php function, taking out the two function that control the weight and size in php.

After that a master.css file will control that typo.
Post Reply