Yeah, String::insert is more like what I'm looking for. However, what I really wanted to see is something that allows me to substitute something model-like. Let`s say
$a = $this->Article->findById(88); $u = $this->User->findById(21); $m = $this->MessageTemplate->findById( 45 ); $this->MessageComponent->send( $u, $m, $a ); so MessageComponent::send is receiving three arrays from models, so $a could be like $a['Article']['name'] => 'xxxxxxxx' $a['Author'][0]['name'] => 'dfajodsijo' $a['Author'][1]['name'] => 'dskpfokp' And in my message template, I could just say "Hello, :$u['User'] ['name'], here is the article $a['Article']['name'] wrote by $a ['Author'][0]['name'] and $a['Author'][1]['name']" that the proper values would fall into places. And my messages placeholders would not have to follow a different nomenclature than it is done in the models. In order to use String::insert, I'd need to map things first, like array( ':username'=>$u['User']['name'], ':articlename' =>$a['Article'] ['name'] ). And I think it's an unnecessary step. What do you think? Thanks!! On Sep 16, 12:06 am, "Dr. Loboto" <[email protected]> wrote: > As all above said, you need placeholders and nothing more. Check > String::insert()http://api.cakephp.org/class/string#method-Stringinsert > to get nice wrap around boring str_replace. > > On Sep 15, 8:09 pm, djogo <[email protected]> wrote: > > > All messages, emails, and receipts that my system sends are stored in > > a database table. This way, system administrators are able to > > customize these messages without having to interact with programmers. > > > Therefore, I need generic placeholders. I could write a hundred substr > > (), for each message type needs different variables (lost password > > email needs user info, project submission receipt needs project data, > > and there you go) > > > That's why I wanted to perform var subst in a variable contents.I > > don't need code evaluation (bad practice, as pointed outra). > > > Dfcp > > > On Sep 14, 9:49 pm, "euromark (munich)" <[email protected]> > > wrote: > > > > thats what bbcode, placeholders etc. and sprintf(), replace functions > > > etc. are for > > > > On 14 Sep., 20:11, brian <[email protected]> wrote: > > > > > On Mon, Sep 14, 2009 at 8:06 AM, djogo <[email protected]> wrote: > > > > > > That's exactly the point, I want it to be in a database column, and > > > > > allow the end-user to edit it. Therefore, $test would keep a HTML/RTF > > > > > document with tags <?=?>. > > > > > > I want to get it, perform variable substitution, and then e-mail it, > > > > > or save it in another database column, but I just don't want to > > > > > display it. > > > > > What do you mean by "allow the end-user to edit it"? What, exactly, > > > > are you trying to do? There's surely a better way, whatever it is. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
