MyBB Community Forums
Turn text between tags into a variable - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Extensions (https://community.mybb.com/forum-201.html)
+--- Forum: Plugins (https://community.mybb.com/forum-73.html)
+---- Forum: Plugin Development (https://community.mybb.com/forum-68.html)
+---- Thread: Turn text between tags into a variable (/thread-22861.html)



Turn text between tags into a variable - Michael S. - 2005-11-07

How do I get the text between tags into a variable?

For example:

This is just [tag]a[/tag] test text!

I want to get: $variable = a;


RE: Turn text between tags into a variable - Smethead - 2005-11-08

to use it in a function? do this:
//Open functions_post.php
//Find:
	$message = preg_replace("#\[email=(.*?)\](.*?)\[/email\]#i", "<a href=\"mailto:$1\">$2</a>", $message);
//After it, add:
	$message = preg_replace("#\[your_tag\](.*?)\[/your_tag\]#ei", "your_function(\"$1\")", $message);
$1 will be the text between the tags.


RE: Turn text between tags into a variable - Michael S. - 2005-11-10

Thanks a lot! Big Grin