I have to folowing problem

I have links in a table Some of thes cells are empty

So if have the folowing code:

</td><TD WIDTH='180px'><p CLASS='WithBreaksNarrow14'><a href="<?php If echo (!$row)) $row; ?> target="_blank" <?php else echo '&nbsp;'; ?>"><font color="orange"><?php echo $row; ?></a></font></p></td>

But my target="_blank" dosn't work and even the color orange dosn't work.
How can i fix that ?

Thanks
In Advice John

Recommended Answers

All 12 Replies

Member Avatar for diafol

Your html is all to hell and you're using deprecated tags (font). Use CSS. Your php is a little suspect too. Unclosed quotes...

<td class="WithBreaksNarrow14"><a href="<?php if(!$row['link']){echo $row['link'];}else{echo "#";}?>" target="_blank"><?php echo $row['treffpunkt_wo'];?></a></td>

I am sorry but your code that you wrote Is not right you typed all double ?

And when i use it my whole output is changed.

I asked only where a link is NOT NULL than the target="_blank" must work Else when the link is NULL in table cell donothing

My css clas for the text in the html code is:

<STYLE type=text/css>
.WithBreaksNarrow1 {
    WIDTH: 55px; WORD-WRAP: break-word;color:white;font-size: 16px; MARGIN-LEFT: 5px 
}
</STYLE>

So i use css

But i want it only orange when the link is NOT NULL.

in advice
Thanks John

In only HTML i have

This one whit link and color orange
<TR>
<TD WIDTH="85px"><p CLASS="WithBreaksNarrow11">Sa. 12-02-2011</p></TD>
<TD WIDTH="65px"><p CLASS="WithBreaksNarrow12">&nbsp;</p></TD>
<TD WIDTH="65px"><p CLASS="WithBreaksNarrow13">19.00</p></TD>
<TD WIDTH="180px"><p CLASS="WithBreaksNarrow14"><a href="http://maps.google.de/maps?hl=de&tab=wl&q=Zonstraat%2033%206463%20AA%20Kerkrade" target="_blank"><font color="orange">Cafe Rolduc</font></a></p></TD>
<TD WIDTH="180px"><p CLASS="WithBreaksNarrow15">Prinzenbegleitung behinderte Kinder, Chevremont</p></TD>
<TD WIDTH="115px"><p CLASS="WithBreaksNarrow16">Wer will</p></TD>
<TD WIDTH="155px"><p CLASS="WithBreaksNarrow17">-----</p></TD>
<TD WIDTH="95px"><p CLASS="WithBreaksNarrow18">Uniform</p></TD>
</TR>

This one whittout link and color white because of the css class

<TR>
<TD WIDTH="85px"><p CLASS="WithBreaksNarrow11">Sa. 12-02-2011</p></TD>
<TD WIDTH="65px"><p CLASS="WithBreaksNarrow12">&nbsp;</p></TD>
<TD WIDTH="65px"><p CLASS="WithBreaksNarrow13">20.00</p></TD>
<TD WIDTH="180px"><p CLASS="WithBreaksNarrow14">Pfarrheim Bank</p></TD>
<TD WIDTH="180px"><p CLASS="WithBreaksNarrow15">Prinzenbegleitung AWO Bank</p></TD>
<TD WIDTH="115px"><p CLASS="WithBreaksNarrow16">Wer will</p></TD>
<TD WIDTH="155px"><p CLASS="WithBreaksNarrow17">-----</p></TD>
<TD WIDTH="95px"><p CLASS="WithBreaksNarrow18">Uniform</p></TD>
</TR>

Member Avatar for diafol

1. Having a <p> inside a <td> doesn't make any sense. If all the class is doing is reiterating the cell width, it has no worth.

2. My code - no biggy, may be ok this time: <?php if($row['link']!=""){echo "<a href=\" {$row['link']}\" target=\"_blank\">{$row['treffpunkt_wo']}</a>";}?> 3. If it's not exactly what you want, it may be close.

I have this a output

< Bij JohnBij John When the link exist it must be Bij John

< kohlscheid and this one when the link is Null in orange

Member Avatar for diafol

Ah OK, I see.

if($row['link']!=""){
   echo "<td><a href=\"{$row['link']}\" target=\"_blank\">{$row['treffpunkt_wo']}</a></td>";
}else{
   echo "<td class = \"nolink\">{$row['treffpunkt_wo']}</td>";
}

And the css:

.nolink{
   color: orange;
}

This could be tidied up considerably though.

Sorry had something done wrong

if have the folowing output some links are gone i don not where the ar some are there

I have now one column more in my table 2 exactly the same

Member Avatar for diafol

No, sorry mate. I'm not following what's going on.

Anybody else?

I know it's not easy but it must be possible in php just like in my html example.
well thanks for your help i wait for someone else who can help me even i trid a lot of things

Just i said thanks for your help i go to bed now.
i wil try again tomorrow.

I have got th solution found by myself here it is

<TD WIDTH='180px'><p CLASS='WithBreaksNarrow14'><?php
if ($row=="")
echo $row["treffpunkt_wo"];
}
else
{
?><a href="<?php echo $row; ?>"target="_blank">
<font color="orange"><?php echo $row;} ?></a></font></p></td>

O yes thanks Ardav for your help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.