• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
add/edit validation with an Object

#5
[eluser]Crafter[/eluser]
Pass your object into an array, then the array into the view

Code:
$user->name = 'Tom Jones';
$user->song = 'Pussycat';

$view_data['user'] = $user;

The view loader extracts the array elements as local variables. You can the use them as objects again.
Code:
<h1> Song List </h1>
The singer &lt;?php echo $user->name; ?&gt; sings the song &lt;?php echo $user->song; ?&gt;<br />
<hr />

EDIT:
DISCLAIMER : I I'm no Tom Jones fan. I don't know what came over me!


Messages In This Thread
add/edit validation with an Object - by El Forum - 09-30-2007, 04:37 PM
add/edit validation with an Object - by El Forum - 10-01-2007, 07:59 AM
add/edit validation with an Object - by El Forum - 10-01-2007, 01:38 PM
add/edit validation with an Object - by El Forum - 10-01-2007, 01:45 PM
add/edit validation with an Object - by El Forum - 10-01-2007, 03:11 PM
add/edit validation with an Object - by El Forum - 10-02-2007, 12:32 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.