We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum
Error in code on PerchTemplate.class.php
Drew, I have run into a problem with my app templates rendering correctly and I tracked the problem down to this in...
// FORMS $contents = str_replace('<perch:form', '<perch:form template="'.$template.'"', $contents);
My app KetterFormsPlus uses the namespace 'forms_plus' when rendering templates. The above line of code is to broad and because my template tags are <perch:forms_plus the string replacement is replacing my perch:forms_plus with perch:form and pushing the 's_plus after the replaced string as seen below...
<perch:form template="\templates\forms_plus\new.html"s_plus <=== SEE HERE s_plus used to be forms_plus before str_replace
When I rename my template namespace k_forms_plus of course the problem goes away. I could just give up on my namespace and move on but this could again become a problem in the future if lets say someone decides to use the namespace perch:formula_one which would be quickly caught in the string replace and become an issue again.
I think the string replace needs to be re-written with regex to avoid this happening again.
Thanks, Let me know what you think...
Want to reply to this thread?Login with Perch