尝试回显HTML表格的按钮

时间:2013-02-01 04:39:01

标签: php html

我试图理解当我运行btn_actions函数时,我没有回复给我。我试图让两个按钮在我的桌子上回显。

echo $this->functions_model->btn_actions(1);
die();

public function btn_actions($item_id)
{
    $content = '<div class="controls center">';
    $content = $this->btn_edit($item_id);
    $content = $this->btn_delete($item_id);
    $content = '</div>';

    return $content;
}

public function btn_edit($item_id)
{
    $button = '<a class="tip" href="'. current_url() . '/edit/' .  $item_id  .'" oldtitle="Edit Task" aria-describeby="ui-tooltip-8"><span class="icon12 icomoon-icon-pencil"></span></a>';
    return $button;
}

public function btn_delete($item_id)
{
    $button = '<a class="tip" href="'. current_url() . '/soft-delete/' . $item_id .'" oldtitle="Delete Task"><span class="icon12 icomoon-icon-remove"></span></a>';
    return $button;
}

2 个答案:

答案 0 :(得分:2)

您需要使用.

进行连接
$content = '<div class="controls center">';
$content .= $this->btn_edit($item_id);
$content .= $this->btn_delete($item_id);
$content .= '</div>';

return $content;

答案 1 :(得分:1)

试试这个:

echo $this->functions_model->btn_actions(1);
die();

public function btn_actions($item_id)
{
   $content = '<div class="controls center">';
   $content = $content . $this->btn_edit($item_id);
   $content = $content . $this->btn_delete($item_id);
   $content = $content . '</div>';
   return $content;
 }

public function btn_edit($item_id)
{
   $button = '<a class="tip" href="'. current_url() . '/edit/' .  $item_id  .'" oldtitle="Edit Task" aria-describeby="ui-tooltip-8"><span class="icon12 icomoon-icon-pencil"></span></a>';
   return $button;
}

public function btn_delete($item_id)
{
    $button = '<a class="tip" href="'. current_url() . '/soft-delete/' . $item_id .'" oldtitle="Delete Task"><span class="icon12 icomoon-icon-remove"></span></a>';
   return $button;
}