I’m working on a custom CMS that has some built-in modules (calendar, weather, etc.) that we would like to allow end users to insert into their content. They can enter content using the CKEDITOR.
Looking for some tips on:
- What is a recommended syntax for entering these codes? We need to retrieve module name and any relevant parameters. Was thinking something like: {{module-name, width=100, height=200, items=5}}
- What PHP functions are best for parsing these?
I know there some templating libraries that may provide this type of functionality, but at this point we want to try to build this part ourselves.
Pick any syntax that will not find accidental use elsewhere in your project. Double curly brackets is probably fine.
Use a regular expression with non-greedy matching to grab the guts of each
from there, you can simply split them by comma and process the individual tokens