CodeIgniter Forums
anchor question - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: anchor question (/showthread.php?tid=30904)



anchor question - El Forum - 05-30-2010

[eluser]dimaomni[/eluser]
hello guys!
when I just output $marks all has been outputed good.

about output - it is table where is cells with marks and empty cells

when I've started used anchor function in empty cells has outputed links.

So how to avoid this situation ?
There is some piece of code:
Code:
foreach ($output_array as $key=>$marks)
          { ?>
            <td>&lt;?=anchor('index.php/adminka/'.$marks, $marks)?&gt;
              &lt;?=(!$marks) ? "&nbsp;":NULL // however if $marks = 0, it output &npsp;?&gt;
            </td>

Thanks!


anchor question - El Forum - 05-30-2010

[eluser]pickupman[/eluser]
I believe it is still outputted because it exists. You have not used any typecasting, so 0 exists. You may want to try
Code:
&lt;?=($marks != '0') "&nbsp;" : '';?&gt;



anchor question - El Forum - 05-30-2010

[eluser]Unknown[/eluser]
foreach ($output_array as $key=>$marks)
{ ?&gt;
<td>&lt;?=anchor('index.php/adminka/'.$marks, $marks)?&gt;
&lt;?=($marks === FALSE) ? "&nbsp;":NULL // however if $marks = 0, it output &npsp;?&gt;
</td>