Welcome Guest, Not a member yet? Register   Sign In
Replace place holder text with php script
#6

[eluser]Stefan Hueg[/eluser]
Here is an example:
Code:
function my_test()
{
  $this->load->library('parser');
  $content = 'My content parser is just ##PLACEHOLDER##';
  $this->parser->set_delimiters('##', '##');
  
  $replacements = array(
   'PLACEHOLDER' => 'awesome!'
  );
  
  $output = $this->parser->parse_string($content, $replacements, TRUE);
  echo $output;
}

which should output "My content parser is just awesome!"

In this example, $content is the variable where the content of your tinyMCE comes from and $replacements is the array with strings that should be replaced.

So, if you have a variable like ##MYVAR## inside of your content, you'll have to add 'MYVAR' => 'my_replacement' to your $replacements-Array.

Clear enough?


Messages In This Thread
Replace place holder text with php script - by El Forum - 04-30-2012, 03:39 AM
Replace place holder text with php script - by El Forum - 04-30-2012, 05:34 AM
Replace place holder text with php script - by El Forum - 04-30-2012, 01:55 PM
Replace place holder text with php script - by El Forum - 04-30-2012, 02:03 PM
Replace place holder text with php script - by El Forum - 04-30-2012, 02:12 PM
Replace place holder text with php script - by El Forum - 04-30-2012, 02:24 PM
Replace place holder text with php script - by El Forum - 04-30-2012, 02:55 PM
Replace place holder text with php script - by El Forum - 05-01-2012, 07:13 PM



Theme © iAndrew 2016 - Forum software by © MyBB