Page 2 of 3

Posted: Fri Dec 26, 2003 12:27 pm
by keffo
one more thingie,

Code: Select all


          if ($list->report == " ") {  

            echo " none "; }  

          else {  

        echo "<a href='?id=$list->id'><img src='img/report.gif' border='0'></a>";  

          } 


this code, what does it do? cause i want it like this.. if there is a report

written it shall display the pic, if $report ( or $list->report ) is empty the picture shall be replaced by a no or something, and there shouldnt be a link

Posted: Fri Dec 26, 2003 1:14 pm
by Den
i dont get ur post :P first u ask something, then u xplain it :P (im not so sober)

Posted: Fri Dec 26, 2003 1:19 pm
by keffo
thats a part of teh cw script and i wonder what i does?



talk later, gotta go

Posted: Fri Dec 26, 2003 1:27 pm
by Den

Code: Select all


if ($list->report == " ") {  

  echo " none "; }  

else {  

  echo "<a href='?id=$list->id'><img src='img/report.gif' border='0'></a>";  

} 



if $list->report is empty then it will echo the text none. If its not empty then its will display the image report with the hyperlink.

Posted: Fri Dec 26, 2003 3:07 pm
by keffo
ok, that was what i thought about.. but its not working ;<

Posted: Fri Dec 26, 2003 3:25 pm
by keffo
even if there is no report the picture comes up ;<



i tried to remove the picture and type yes and no

but its still not w0rking ;<

Posted: Fri Dec 26, 2003 3:38 pm
by Clement
instead of


Code: Select all


if ($list->report == " ")



try:


Code: Select all


if ($list->report != "")



and then of course switch the content of the if and the else thingie..

Posted: Fri Dec 26, 2003 5:11 pm
by keffo
ye it work! but! now all the "non reports" is yes and have a link ;)

it should be the other way.. heh


Code: Select all

          if ($list->report != "") {  

            echo " nop "; }  

          else {  

        echo "<a href='?id=$list->id'>yes</a>";  

          } 

Posted: Fri Dec 26, 2003 5:22 pm
by Clement
Morpher wrote:
and then of course switch the content of the if and the else thingie..


:)



It would look like this then:


Code: Select all


if ($list->report != "") 

            {  echo "<a href='?id=$list->id'><img src='img/report.gif' border='0'></a>"; 

            }  

  else 

            {  

        echo " none "; 

            }


Posted: Fri Dec 26, 2003 5:53 pm
by keffo
goode ;) you're teh king.. thx

Posted: Sat Dec 27, 2003 8:33 am
by keffo
elo again, i have one more question.. i was about to add in the report stuffs, something like "homepage: http://domain.com/clan" or something

but i need to know if there is something i need to make it to a link, or is it

just to write the domain in the fields?





sorry for bad explaniation, ask if you dont uinderstand

Posted: Sat Dec 27, 2003 9:06 am
by Den
well diddnt get everything what u said but here goes:



echo "<a href='?id=$list->homepage'>$list->homepage</a>";



i think u mean this ?

or make a replace function

Posted: Sat Dec 27, 2003 11:14 am
by keffo
nah, i mean more like.. if i want to add the opponents homepage to the report site, and i just write the url.. does it make it as a link automaticlly? then?

Posted: Sat Dec 27, 2003 11:47 am
by Den
no it doesnt, but a replace function would do that.



[php]<?php

function auto_link($text) {

RETURN eregi_replace("(http://([a-zA-z0-9_-]+[\.]{1})*[\.]{0,1}[a-z]{2,3})","<a href=\"\\1\" target=\"_BLANK\">\\1</a>",$text);

}

?>[/php]



This will change every link in ur text, other option is that u write the html tag. (<a href='link'>link</a>)

Posted: Sat Dec 27, 2003 12:25 pm
by keffo
yess, but i will use it on a form field.. so i dont know how i shall bake it in :(



if you understand.. can you give me some example?