Forums

Change site template with form using DB Save function!

hennysmafter 07 Jun, 2012
Dear GreyHead and all other admins, users and bright minds of Chronoengine,

A client asked me to make a form that allows the (logged in(only 1 person can login)) user to change the site template through the frontend.

I know 1000% that this is possible with ChronoForms. The client is using Joomla 1.5.26 with Chronoforms 4.0 RC3.4.1

What i have done is making a form with 2 items a dropdown box with the templatenames and a submit button(see attachement)

WHAT I WANT TO ACHIEVE IS that basically the user loges in and see the form in a module. in this module he selects the template and clicks on submit. then the form changes inside the databasetable the template name which immediately changes the template of the website <= i hope it is clear!

I have tested by typing manually in phpMyAdmin the different templatenames and it works(offcourse) so i know that this could be done by chronoforms.

Can someone please look at my form and tell me what i am doing wrong so that i can make my client happy as well as all the other people on the interweb that are also looking for a DefaultTemplateSwitcher from the frontend.

I am in the position to create a online testsite if that is necassery please let me know.

Thanks in advance.

With regards,

Henny
Max_admin 10 Jun, 2012
Hi,

Do you think its a good idea to let your users change templates permanently on the frontend ?🙂

here is how:

In the "On load" even, create a drop down for your templates, the value field of the options should be the templates ids, you can do this easily using the "Dynamic data" in the dropdown element, the dropdown name should be Template[id]

In the "on submit" event, you will need a "Custom code" action with this line:
$form->data['Template']['home'] = 1;


Then you need a "DB Save" action, connected to the jos_template_styles table, set the "Save under Model ID" to "yes" and set the Model ID to "Template".

Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
hennysmafter 11 Jun, 2012
Dear Max,

First of all thanks for your help! I have done everything you have said. Hopefully i did it right.

The Client is running Joomla 1.5.26

i have created a drop down and when i go to dynamic data i have filled in the following: (see picture 1.jpg)[attachment=2]1.jpg[/attachment] the rest of the settings i have left to standard.
I have also added to the form an submit button!
These 2 the dropdown and the submit are added as elements.

then i went to the On Load event and added the Show HTML event

In the On Submit event i have created custom code with the line you provided me with (see picture 2.jpg)[attachment=1]2.jpg[/attachment]

I also added the DB Save function and used the following settings (see picture 3.jpg)[attachment=0]3.jpg[/attachment] I cannot connect to the jos_template_styles because that table is not in the database

At this moment it is now working the dropdown has no values so i have done something wrong.

Is it oke if i PM you details to login to a testenvironment so that you could see what i am doing wrong.

Thanks for all the help,

Henny

PS TESTENVIRONMENT IS FULLY SETUP. I SEND YOU THE LOGIN DETAILS IN ADVANCE. I HOPE YOU DONT MIND!
hennysmafter 13 Jun, 2012
Dear Chronoengine staff, admins and all other people browsing this form,

My client is getting on my nerves. Please help me with this anyone who want to help and need the codes for the testenvironment just reply and i get them to you asap.

Any help is appreciated.

With regards,

Henny
GreyHead 14 Jun, 2012
Hi Henny,

In your first post you said that you were 1000% confident that this could be done and that you had done it my editing the database. Which table exactly do you need to change.

I see that Max's reply related to Joomla! 2.5 but that you are working with 1.5.

Bob
hennysmafter 14 Jun, 2012
Dear Greyhead,

I need the change in the table jos_templates_menu

In this table i can see the following:
[attachment=0]1.png[/attachment]

When i change "rhuk_milkyway" to "beez" or any other template name then the template changes.

PS: I send you my test environment details in here you have fullaccess to front & backend aswell as phpMyAdmin full access. I hope you dont mind!

With regards,

Henny
GreyHead 14 Jun, 2012
Hi Henny,

Ok Then I think you have your options back to front. The format is value=text so instead of
Alpha=Alpha
Bravo Blauw=Bravo_Blauw
Bravo Groen=Bravo_Groen
Bravo Geel=Bravo_Geel
Bravo Rood=Bravo_Rood
you probably need
Alpha=Alpha
Bravo_Blauw=Bravo Blauw
Bravo_Groen=Bravo Groen
Bravo_Geel=Bravo Geel
Bravo_Rood=Bravo Rood
and the values must exactly match the values that you need to set in the jos_templates_menu table.

ob
GreyHead 15 Jun, 2012
Hi Henny,

;-) :-)

Bob
This topic is locked and no more replies can be posted.