Also, if you want to make a “fake variable” like full_name out of
first and last names, try this:
(inside the model)
function full_name(){
return $this->first_name . ’ ’ . $this->last_name;
}
And then, if you have the __get() function set up to map missing
variables to model methods, you can just put in $object->full_name and
get the result you want. If you don’t have __get() in your model path,
then you simply put in $object->full_name() where you want that full
name string to appear.
The __get() trick is defined in _app.php in the latest (Generate)
branch of MAR, and can be added elsewhere using this syntax:
//inside of MyActiveRecord or one of its subclasses:
function __get($variableName){
if( method_exists($this,"$variableName")){
return call_user_func( array($this, "$variableName" ) );
}
die('Could not locate ' . $variableName);
}
Walter
On Nov 20, 2010, at 2:36 PM, Todd wrote:
Upon successful submission the admin receives a confirmation email
with the person’s first name only. In the Model file I’m trying to
add both first and last name variables but keep getting errors. I’ve
been through my Fat Book of PHP but can’t find the correct syntax to
use. Here’s the current setup which works great:
else{
$to = 'email@hidden';
$subject = 'MAR Submission';
$body = $this->first . ' has been added to the database. View the
details at http://somesite.com.';
$body = print_r($this,true);
mail($to,$subject,$body,'From: email@hidden','email@hidden');
if(!is_null($strSession)) $_SESSION[$strSession] =
flash($strMessage);
return header('Location: ' . $strRedirectTo);
}
Todd
dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options
dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options