heading()

heading([$data = ''[, $h = '1'[, $attributes = '']]])

Parameters:
  • $data (string) – Content
  • $h (string) – Heading level
  • $attributes (mixed) – HTML attributes
Returns:

HTML heading tag

Return type:

string

Lets you create HTML heading tags. The first parameter will contain the data, the second the size of the heading. Example:

echo heading('Welcome!', 3);

The above would produce: <h3>Welcome!</h3>

Additionally, in order to add attributes to the heading tag such as HTML classes, ids or inline styles, a third parameter accepts either a string or an array:

echo heading('Welcome!', 3, 'class="pink"');
echo heading('How are you?', 4, array('id' => 'question', 'class' => 'green'));

The above code produces:

<h3 class="pink">Welcome!<h3>
<h4 id="question" class="green">How are you?</h4>
doc_CodeIgniter
2016-10-15 16:32:24
Comments
Leave a Comment

Please login to continue.