[eluser]jay2003[/eluser]
Hi,
I am building a CMS and have created helpers for certain items such as forms, image sliders, photo gallery etc.
I am now integrating them with my page loader controller and am a little stuck, I have added dropdowns to tinymce which insert the code ##FORMBUILDER-1## or ##GALLERY-2## etc where the number is the unique key for the form/gallery they have selected.
I have used the following code before but only for a single contact form, for this system I now need to be able to retrieve the number after the - automatically so I can pass it into my helper to retrieve the correct form.
Code:
$this->load->library('parser');
$this->parser->set_delimiters('##', '##');
$content = $page['page_content'];
$replacements = array(
'##FORMBUILDER-1##' => form_builder(1)
);
$new_page_content = $this->parser->parse_string($content, $replacements, TRUE);
I know I could do it by creating this replacements array for all of my forms, galleries etc that are on the system and then it would just replace the ones which are included in the page but feel thats a little wasteful for each page load of the system.
Is there a way to get this value from the text so I can just create the replacements array with the required values for each page?
Thanks in advance
Jason