Jump to content

Archived

This topic is now archived and is closed to further replies.

dcart

Help with this code (making title a link)

Recommended Posts

I have the following code and I would like the title to be a link not only the "Read.." section but I can't seem to get it work. Is it doable? Thank you in advance!

{
echo "<b>";
printf($therow["title"]);
echo "</b><br><i>";
printf($therow["date"]);
echo "</i><br>";
printf($therow["summary"]);
echo "<br><a href=\"$PHP_SELF?id=";
printf($therow["id"]);
echo "\">Read</a>...";
echo "<br><br>";
}

Share this post


Link to post
Share on other sites
OK, what do you want to use as link title?
Let's say you have a field called "title":

[code]echo "<a href='$PHP_SELF?id=$therow[id]'>Read $therow[title]</a>...";[/code]

Share this post


Link to post
Share on other sites
Thank you for such a prompt asnwer!

I'm sorry for not being too detailed, I'm really clueless with PhP. I wanted the title to have the same link as the "Read.." Is that what the code you just gave me will do? The title is a title of an article.

Thank you!

Share this post


Link to post
Share on other sites
One more question, how can make that title to be a certain color? (different than everything else on the site)

Thank you!

echo "<a href='$PHP_SELF?id=$therow[id]'>$therow[title]</a>...";

Share this post


Link to post
Share on other sites
I'd need to know how this title is stored in the database or whatever it is its storing method to give you an answer.

Anyways... To change it's color, you must use normal HTML/CSS, like:

<a style="color: white"...

Share this post


Link to post
Share on other sites
[!--quoteo(post=379226:date=Jun 1 2006, 10:16 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Jun 1 2006, 10:16 PM) [snapback]379226[/snapback][/div][div class=\'quotemain\'][!--quotec--]
I'd need to know how this title is stored in the database or whatever it is its storing method to give you an answer.

Anyways... To change it's color, you must use normal HTML/CSS, like:

<a style="color: white"...
[/quote]

The code for title that you gave me works very nicely, it displays exactly what I wanted. As to the color, can I use the folowing? (I would like to use a color numbe #660000)

echo "<a style="color: #660000" href='$PHP_SELF?id=$therow[id]'>Read $therow[title]</a>...";

Thank you so much for your help!

Share this post


Link to post
Share on other sites
[code]echo "<a style='color: #660000' href='$PHP_SELF?id=$therow[id]'>Read $therow[title]</a>...";[/code]

or

[code]echo "<a style=\"color: #660000\" href='$PHP_SELF?id=$therow[id]'>Read $therow[title]</a>...";[/code]

Share this post


Link to post
Share on other sites
awesome! Thank you! I hate to do this again but what about making the title bigger. How can I change the font size?

Share this post


Link to post
Share on other sites
[code]"<a style=\"color: #660000\" href='$PHP_SELF?id=$therow[id]'>Read $therow[title]</a>...";[/code]

to

[code]"<a style=\"color: #660000; font-size: 15pt\" href='$PHP_SELF?id=$therow[id]'>Read $therow[title]</a>...";[/code]

Will set the font-size to 15pt

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.