在一个 HTML <td> 标签中给出两个链接
Give two links in one HTML <td> tag
这是一个 <td>
标签,它有 link 去 marks/details/index/someId,
<td>
<a href="<?php
echo $this->url('marks/details',array('action'=>'index','id'=>$item['studentAcademicId']))
?>">
<?php
if(($item['marksObtained'])!= Null )
{
echo $item['marksObtained'];
}
else {echo 'Add Marks'; };
?>
</td>
我想在 else {echo 'Add Marks'; }
之后的同一个 <td>
中添加另一个 link,这将转到另一个 link,例如 Marks/details/addfromsession/someId
anchor 标签没有关闭,你可以添加anchor。像下面这样
<td>
<a href="
<?php echo $this->url(
'marks/details',array('action'=>'index','id'=>$item['studentAcademicId']))?>">
<?php if(($item['marksObtained'])!= Null )
{ echo
$item['marksObtained'];}
else {echo 'Add Marks'; };?> </a>
<a href="SOME LINK">SOME TEXT</a>
</td>
This is the correct way to pass two links in one HTML <td>
tag.
<?php foreach ($this->data as $item): ?>
<tr>
<td>
<?php if(isset( $item['marksObtained']) && $item['marksObtained'] > 0){?>
<a href="<?=$this->url( 'marks/details', array('action'=>'index', 'id'=>$item['studentAcademicId']))?>">
<?php echo $item['marksObtained']; ?></a>
<?php }else{ ?>
<a href="<?=$this->url( 'marks/details', array('action'=>'add', 'id'=>$item['studentAcademicId']))?>">
Add Marks</a>
<?php }?>
</td>
</tr>
<?php endforeach;?>
If condition is true, one link is passed, else the other link is passed, So now we have two tags that are working exactly to the question.
这是一个 <td>
标签,它有 link 去 marks/details/index/someId,
<td>
<a href="<?php
echo $this->url('marks/details',array('action'=>'index','id'=>$item['studentAcademicId']))
?>">
<?php
if(($item['marksObtained'])!= Null )
{
echo $item['marksObtained'];
}
else {echo 'Add Marks'; };
?>
</td>
我想在 else {echo 'Add Marks'; }
之后的同一个 <td>
中添加另一个 link,这将转到另一个 link,例如 Marks/details/addfromsession/someId
anchor 标签没有关闭,你可以添加anchor。像下面这样
<td>
<a href="
<?php echo $this->url(
'marks/details',array('action'=>'index','id'=>$item['studentAcademicId']))?>">
<?php if(($item['marksObtained'])!= Null )
{ echo
$item['marksObtained'];}
else {echo 'Add Marks'; };?> </a>
<a href="SOME LINK">SOME TEXT</a>
</td>
This is the correct way to pass two links in one HTML
<td>
tag.
<?php foreach ($this->data as $item): ?>
<tr>
<td>
<?php if(isset( $item['marksObtained']) && $item['marksObtained'] > 0){?>
<a href="<?=$this->url( 'marks/details', array('action'=>'index', 'id'=>$item['studentAcademicId']))?>">
<?php echo $item['marksObtained']; ?></a>
<?php }else{ ?>
<a href="<?=$this->url( 'marks/details', array('action'=>'add', 'id'=>$item['studentAcademicId']))?>">
Add Marks</a>
<?php }?>
</td>
</tr>
<?php endforeach;?>
If condition is true, one link is passed, else the other link is passed, So now we have two tags that are working exactly to the question.