Reputation: 9615
How to end the tag in cake php
It is given in cake tutorial the below span tag will be formed by html helper, when text is given null.
<?php echo $this->Html->tag('span', null, array('class' => 'welcome'));?>
//Output
<span class="welcome">
But, here no idea about ending span tag.How can it be given html helper
<span class="welcome">
//inner elements
</span>
Is there anything in cake php html helper to close any element tags like
<?php echo $this->Html->tag('span', 'close') ?>
will output as
</span> .
Upvotes: 1
Views: 1681
Reputation: 9964
You have to provide an empty string ""
, instead of null
, for the second parameter when calling the tag
method. Otherwise, it just prints the start tag according to the API docs.
Upvotes: 1
Reputation: 1254
You can also do this:
<?php
echo $html->tag("span", null);
... whatever ...
echo $html->tag("/span", null);
?>
Upvotes: 2