/** * @return \Twig_Environment */ public function setEnvironment() { $this->properties['twigLoader'] = new \Twig_Loader_Filesystem($this->view->views); $this->template = new \Twig_Environment($this->properties['twigLoader'], array('cache' => getcwd() . DS . APPPATH . DS . 'temp' . DS . 'twig' . DS . 'tmp' . DS . 'cache', 'auto_reload' => $this->properties['autoReload'], 'debug' => $this->properties['twigDebug'])); $function = new \Twig_SimpleFunction('link', function ($link, $name = null, $attributes = array()) { return Asset::link(str_replace('.', '/', $link), $name, $attributes); }); $this->template->addFunction($function); return $this->template; }
<?php use Cygnite\AssetManager\Asset; ?> <div class="pull-right"> <?php echo Asset::link('product', 'Back', array('class' => 'btn btn-default btn-small btn-inverse')); ?> </div> <div class="error" style="color:#FF0000;"> <?php echo $this->validation_errors; ?> </div> <div > <?php echo $this->form; ?> </div>
private function setLink() { // We will set default function to twig engine $this->functions[] = $this->getTwigSimpleFunctionInstance('link', function ($link, $name = null, $attributes = array()) { return Asset::link(str_replace('.', '/', $link), $name, $attributes); }); return $this; }
$rowType = $i % 2 == 0 ? 'even' : 'odd'; ?> <tr class='<?php echo $rowType; ?> '> <td> <?php echo $i; ?> </td> {#tdColumns#} <td> <?php echo Asset::link('#controllerName#/show/' . $value->id, 'View', array('class' => 'btn btn btn-info')); echo Asset::link('#controllerName#/type/' . $value->id, 'Edit', array('class' => 'btn btn btn-info')); echo Asset::link('#controllerName#/delete/' . $value->id, 'Delete', array('class' => 'btn btn-danger')); ?> </td> </tr> <?php $i++; } } else { echo '<tr> <td >No records found !</td></tr>'; } ?> </tbody> </table>
</td> <td><?php echo $value->created_at; ?> </td> <td><?php echo $value->updated_at; ?> </td> <td> <?php echo Asset::link('product/show/' . $value->id, 'View', array('class' => 'btn btn btn-info btn-xs')); echo Asset::link('product/edit/' . $value->id, 'Edit', array('class' => 'btn btn-default btn-xs')); echo Asset::link('product/delete/' . $value->id, 'Delete', array('class' => 'btn btn-danger btn-xs')); ?> </td> </tr> <?php $i++; } } else { echo 'No records found !'; } ?> </tbody> </table>
<?php use Cygnite\AssetManager\Asset; ?> <div style="float:right;margin-right:47px; margin-bottom: 10px;margin-top: 10px;"> <?php echo Asset::link('#controllerName#', 'Back', array('class' => 'btn btn btn-info')); ?> </div> <div class="error"> <?php echo $this->validation_errors; ?> </div> <div style="float:left;"> <?php echo $this->form; ?> </div>