3395 Posts in 977 Topics by 853 members
|Go to End|
1 May 2009 at 12:46pm
I have modified the Form.ss and copied my modified version into my templates folder.
Now this form.ss is used for the login form, for the password forgotten and the user defined form. But also in the cms, which produces strange effects.
Is there a way to solve this ? I mean it shall be used everywhere in the frontend, but simply not in the cms, thats all.
I see that this kind of thing has been discussed several times, but each time the problem was slightly different.
Thanks for help in advance
PS: I know, that I can change $Form in my Page.ss to
<% if Form %>
<% include myForm %>
<% end_if %>
But the login form comes with $Content, which doesn't seem to be an object, so that I can't stop it using the default form.ss. Which again is either not my desired form.ss or my own form.ss which than again is used by the cms too
31 May 2009 at 1:47pm
Hi, I realise this is an old post but I just spotted it and thought I'd share my solution to this problem.
I basically made a form extension that has an isFrontend() method that checks the URL to see if we're in admin. There's probably a much better way to do that bit but it works for now. Anyway, then I overwrote Form.ss and put in an if statement - if isFrontend(), then include PageForm.ss (which goes in your theme's includes folder) else use HTML I copied and pasted from the original Form.ss.
Not perfect I'm sure but so far it seems to work. I've attached a zip of the relevant files, but you still need to make your own PageForm.ss with whatever layout code you want.
4 June 2009 at 6:07am
Hey thanks, that helped.
There were some defects in your code and I had to modify and add some code.
However, your idea is a great solution more than enough for me
Also my Silverstripe didn't want to take the form.ss from your Includes-Directory, but it works fine when my modified PageForm.ss and the default(/cms) Form.ss are in my themes/Includes directory.
Hope others will find this helpfull, too
4 June 2009 at 9:49am
Glad it helped, and yes in this case my line of thinking was better than my code
I'm not sure why it wasn't reading Form.ss for you though, it works fine for me keeping Form.ss in the form_template module...
4 June 2009 at 11:09am
I use the user defined form module, too. Maybe that's interfering somehow ?!
4 June 2009 at 1:48pm
Actually I'm thinking the problem is the name of the module - SS reads through the modules alphabetically, so since form_template comes before sapphire, sapphire's form.ss is overriding it.
I didn't have this problem because I extracted this code from a larger module called xfm_extensions...so if you renamed this to template_forms or something that comes after "s" it should work.
|Go to Top|