Is it bad to break out of php inside a function? -



Is it bad to break out of php inside a function? -

more point, 1 of these faster or considered 'better' other?

function name_field($name){?> <div class="input-wrap"> <label for="name">name:</label> <input type="text" id="name" value="<?php echo $name; ?>"/> </div> <?php }

compared to:

function name_field($name){ $output = '<div class="input-wrap">'; $output .= '<label for="name">name:</label>'; $output .= '<input type="text" id="name" value="' . $name . '"/>'; $output .= '</div>'; echo $output; }

what preference ...

use mustache , save name_field.html

<div class="input-wrap"> <label for="name">name:</label> <input type="text" id="name" value="{{name}}"/> </div>

and

function name_field($name) { echo $this->m->render("name_field", array('name' => $name)); }

this seperates html php , larger examples comes in extremely handy

php

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -