The problem here is that you cannot use a a method call like your $this->lang->line('link_sendactivation')
inside a string declaration.
You either need to get the return value of that method in advance and store it in a temporary variable:
$tmp = $this->lang->line('link_sendactivation');
$returnValue = "<a onclick='demosuccess(".chunk_split(base64_encode($details['clientid'])).",".chunk_split(base64_encode($details['email'])).",1)' >$tmp</a>";
Or you concatenate that return value with the other parts (just like you did it with chunk_split
):
$returnValue = "<a onclick='demosuccess(".chunk_split(base64_encode($details['clientid'])).",".chunk_split(base64_encode($details['email'])).",1)' >".$this->lang->line('link_sendactivation')."</a>";
Or you use sprintf
like Gordon suggested:
$returnValue = sprintf("<a onclick='demosuccess(%s,%s,1)' >%s</a>",
chunk_split(base64_encode($details['clientid'])),
chunk_split(base64_encode($details['email'])),
$this->lang->line('link_sendactivation'));
Futhermore you probably forgot to quote the chunked Base-64 values in JavaScript. You can use json_encode
to do that:
$returnValue = sprintf("<a onclick='demosuccess(%s,%s,1)' >%s</a>",
json_encode(chunk_split(base64_encode($details['clientid']))),
json_encode(chunk_split(base64_encode($details['email']))),
$this->lang->line('link_sendactivation'));