Welcome Guest, Not a member yet? Register   Sign In
Using a helper function in the View file
#9

[eluser]bretticus[/eluser]
I think the debate is valid. For me, what draws the line on whether I use a helper function (or out-right PHP functions) in a view is whether the function is used for layout purposes. I don't have a problem with converting data with a function in a view for formatting tweaks.

For example:

Code:
<html>
<!-- ... -->
<?php foreach($events as $event): ?>

<?= $event->name ?> <?= date('m/d/Y g:i:s', strtotime($event->datetime)) ?>

<?php endforeach; ?>


If the designer knows a little PHP code (the designer is often me in this scenario anyways) he or she can tweak the layout a little even.


Messages In This Thread
Using a helper function in the View file - by El Forum - 04-26-2012, 08:01 AM
Using a helper function in the View file - by El Forum - 04-26-2012, 09:44 AM
Using a helper function in the View file - by El Forum - 04-26-2012, 09:54 AM
Using a helper function in the View file - by El Forum - 04-26-2012, 09:56 AM
Using a helper function in the View file - by El Forum - 04-26-2012, 10:14 AM
Using a helper function in the View file - by El Forum - 04-26-2012, 10:18 AM
Using a helper function in the View file - by El Forum - 04-26-2012, 10:27 AM
Using a helper function in the View file - by El Forum - 04-26-2012, 10:49 AM
Using a helper function in the View file - by El Forum - 04-26-2012, 11:15 AM
Using a helper function in the View file - by El Forum - 04-26-2012, 12:18 PM
Using a helper function in the View file - by El Forum - 04-26-2012, 12:29 PM
Using a helper function in the View file - by El Forum - 04-26-2012, 02:10 PM



Theme © iAndrew 2016 - Forum software by © MyBB