Welcome Guest, Not a member yet? Register   Sign In
Email template (view) : possible? how to?
#1

[eluser]Scal[/eluser]
Hi;
is it possible to use a View as email template? Or do I have to create a file like a view and read the file content to set it as the email body value?

Something like:
$body = $>this->view->load('mytemplate', $data_array);
$this->email->message($body);

Or should I use "regular PHP" to:
- open the 'mytemplate.php' file in read mode
- store it locally
- replace the parameter(s) with their actual values on the local variable
- pass the local variable to the Email library message method

Thanks for the feed back.
Scal
#2

[eluser]n0xie[/eluser]
[quote author="Scal" date="1255561808"]Hi;
is it possible to use a View as email template?[/quote]
yes
#3

[eluser]cahva[/eluser]
"yes"... what kind of answer is that? Smile

Ok to the question. You almost had it(minus the syntax errors Wink ). Use third parameter to return the view and save it to $body variable:
Code:
$body = $this->load->view('mytemplate', $data_array, true);
#4

[eluser]Scal[/eluser]
Sweet;
thanks guys for the answers. More specially to cahva as it was a bit more helpful Wink
#5

[eluser]n0xie[/eluser]
[quote author="cahva" date="1255563009"]"yes"... what kind of answer is that? Smile
[/quote]
The right one? ;-P

[rant]
The question was 'can I do {insert option here}'. The only answer to that is 'yes you can'. Explaining how would be pointless since he already came up with the solution, he just needed verification if it was 'correct'. Else the question would have been 'how do I {insert option here}'.

I'm all for helping people, but most programmers are self taught (thus quite resourceful) and only need a nudge in the right direction to figure something out (which is half the fun of programming to begin with). Giving people spoonfed answers makes them less resourceful and contributes to the 'too lazy to google' syndrom.

Teach a man to fish and all that.
[/rant]
#6

[eluser]wiredesignz[/eluser]
@cahva, From about 500 - 1000 posts appears to be every forum member's smart ass phase.
#7

[eluser]cahva[/eluser]
[quote author="wiredesignz" date="1255583072"]@cahva, From about 500 - 1000 posts appears to be every forum member's smart ass phase.[/quote]

Smile

Only ~360 posts to go and I'll go into smart-ass mode Big Grin
#8

[eluser]cahva[/eluser]
@noxie: Im fisherman's friend also and all that. Atleast you could have do is tell that the solution is found in the manual. So the correct answer would have been:

Yes. RTFM.


Smile
#9

[eluser]Scal[/eluser]
[quote author="cahva" date="1255620823"]So the correct answer would have been:

Yes. RTFM.


Smile[/quote]

Amen to that as final note Smile




Theme © iAndrew 2016 - Forum software by © MyBB