Jump to content


Photo

Help with this code (making title a link)


  • Please log in to reply
8 replies to this topic

#1 dcart

dcart
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 31 May 2006 - 02:17 AM

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>";
}

#2 poirot

poirot
  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 31 May 2006 - 02:48 AM

OK, what do you want to use as link title?
Let's say you have a field called "title":

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

~ D Kuang

#3 dcart

dcart
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 31 May 2006 - 02:58 AM

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!

#4 dcart

dcart
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 02 June 2006 - 02:12 AM

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>...";

#5 poirot

poirot
  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 02 June 2006 - 02:16 AM

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"...
~ D Kuang

#6 dcart

dcart
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 02 June 2006 - 05:14 AM

[!--quoteo(post=379226:date=Jun 1 2006, 10:16 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Jun 1 2006, 10:16 PM) View Post[/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!

#7 poirot

poirot
  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 02 June 2006 - 01:59 PM

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

or

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

~ D Kuang

#8 dcart

dcart
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 03 June 2006 - 03:13 AM

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

#9 poirot

poirot
  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 03 June 2006 - 04:54 AM

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

to

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

Will set the font-size to 15pt
~ D Kuang




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users