I am trying to add <% Include ContactForm2 %> at the halfway point in my content. I cannot therefore use a template, however I thought it would be simple enough to edit the source code in the CMS editor. However, the source editor seems to strip the <% %> elements which is extremely frustrating! What is the point in having a source editor when you can't actually edit properly?
Anyway, I have searched the internet for two hours to try and find a fix and it seems that many people have a similar problems but i can't actually find a solution. As soon as I think im getting warm im presented with a dead link!
Sorry to hear your frustrations, but welcome to the forums!
The <% %> tags are for the templating laguage that is intended for developer use only as far as I know and should only be editted via a text editor. The TinyMCE within the system is for a CMS user only - I cannot imagine what woes would result in allowing these tags in TinyMCE a user could change upon some code and cause some serious damage to a live system.
I am trying to add a form half way through my page. I have generated the fields in ContactForm2.php, dropped them into a template ContactForm2.ss which is in my includes folder. I want to include this form on my homepage but inbetween some of the content that I have added via the CMS.
I am the only person that will access the CMS so there is no risk of an end user destroying the page from the inside out. I thought that by simply adding <% Include ContactForm2 %> in the html source editor it should drop my form exactly where i want it. Sadly it wont allow me!
This is a great module but unfortuanately it can be a bit misleading $UserDefinedForm can be added with the Content throught the CMS and it looks like templating code, but it is not, the code does a straight str_replace to then place the form.
Hi Olly to include your form code in the CMS you can do it one of two ways;
1 - Setup a shortcode which will allow you to place [contactform] anyway in the tinyMce editor and it will generate your form there,
2 - Do a string replace (such as the UserDefinedForm module does) to search for a sting such as $ContactForm and then replace it with template code containing the form