I have a WYSIWYG editor and my client wants to use a similiar pattern like Wordpress shortcodes.
Effectively the client wants to do something like:
[.class_name]
/// Some content here
[/close_container]
I am able to easily replace [/close_container] by using str_replace(), but as class_name will change with each shortcode used (say it was [.green_block] I first somehow have to capture green_block and then replace the entire [.green_block] with <div class='green_block'>. There is no predefined list of classes so I am a little clueless as how to approach this.
Any ideas?
strposcan help you to find it, andsubstr_replaceto replace<div class="...">...</div>and done?[class=.class_name]?