News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Custom Form Mod

Started by live627, July 09, 2008, 10:24:44 PM

Previous topic - Next topic

Nathaniel

Firstly, sorry to everyone that I haven't responded to this topic recently, I have been meaning to, but the list of posts just keeps getting longer and longer. I also mean to look at updating/fixing this mod within the not to distant future, but thats a completely different story. ;)

Anyway, this is going to be a HUGE post. Please bump if I miss your posts.

@Paracelsus,
Good to hear that it works well. I still believe that there are issues. I will try and resolve them with the next version of the mod.

@Propaganistas,
I am not familiar with that mod, could you please post your 'ModSettings.php' and 'Subs-Post.php' file, so that I can have a look over them?

@Garou,
I am glad that you like the mod. The idea of having a WYSIWYG editor for the PHP/HTML is probably not likely to happen (as it would require too much work), although I may add a way to edit the template for each function via the admin area - that may make it easier for admin with lower PHP/HMTL skills.

@Dem0n,
As meantioned by Garou, choice of redirection location after forum submittion is one of the features that I am looking at implementing.

@Garou,
Do you still need any help with those templates?

@the.basement,
After reading through your post, I can't say that I have any idea what you issue actually is. Do you still require assistance?

@pooya,
As Garou said, I am looking at implementing that in the next version.

@happyfeet,
At the moment I haven't even really found the time to find and work out a solution for most of these issues.

@NeQo,
Interesting suggestion, I will think about adding it to a future version. As Garou suggested, making the mod post to different boards based off user input will require quite a few changes within the code of the mod. While the 'board' for each form is stored in the 'smf_cf_forms' database table, the actual use of the information is in the 'CustomForm.php' file. You may be able to archive what you want with some code changes in that file, although I wouldn't recommend it. ;)

SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

Garou

LHVWB!!! Welcome back to the thread.

I figured out the templates and made a post that hopefully makes it easier for any one else that wants to learn. I figured the WYSIWYG would be to complicated to actually do but I also think you misunderstood. I was thinking more along the lines of dumping the php file all together and having something where Admins could write something up using the BBC that they are familiar with that would save to the database rather then changing the template php.

Either way I know its too complicated and huge of a task to make work. If I had any clue where to begin I do it and give it to you to add. I am learning quite a bit about this mod and others here of late though. A lot of mod authors are busy with other things lately and I'm happy to help where I can. :)

the.basement didn't have any problems, in fact he came up with a fix for the required fields bug. Unfortunately he just repackaged the whole mod when it was one line of code that was actually changed. I compared his package to yours and listed the fix a few posts back.

Nathaniel

@Garou,
Hmm, interesting suggestion about the BBC editor for the template. I'll have a think about it. I am definetly looking at making this mod easier to use (while adding more features), with the next version, so an option to do that could work well - I also don't think it would be that difficult. ;)
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

Garou

Well once I figured out the template thing and the.basement found the required fields bug this mod will do almost everything I need it to do.

The one thing left Id like to see in it is being able to set a message Icon. Mainly because I got an idea for a site that will have multiple forms post in one board. Of course I can set the titles for each type of form but being able to have an icon that stands out a little more would be nice.

I don't know that Id actually use it but Ive come up with a couple of ideas for the suggestion someone else made about it putting all posts from a form in one thread/topic.

The BBC for the template just might make it easier for admins that don't know any php or xml. I personally may have been frustrated at first but I actually enjoyed figuring out how to do the template. I needed and still need more coding experience anyway.  :)

Nvb

Question:

I have been looking at the smf_cf_forms.sql file and i have noticed the following

This is the file, and i see following forms:
INSERT INTO `smf_cf_forms` VALUES (1, 348, 'P5 test',...
INSERT INTO `smf_cf_forms` VALUES (6, 328, 'test2',...
INSERT INTO `smf_cf_forms` VALUES (5, 5, 'test',...

Am i right that those values are the following:

1e value: form creation number
2e value: form board number
3e value: form name

I think it's a risky thought, but could i copy the form layout and fields (they are mentioned in the file) from 1 form and copy them into another form.
Then i only need to change the 'creation' and 'board' number from another form to have an exact same one, but for another board.
Would it be risky to upload the altered smf_cf_forms.sql file to mySQL database?

Or am i completely "coeckoe"  :P ?

Lemme know what you think

Garou

Yes it can be done and yes it gets a little risky.

First, make sure you have a backup of your files for both smf_cf_fields and smf_cf_forms. I tried something similar and wound up erasing the data I already had. Luckily I had the forethought to back up.

smf_cf_fields contains all the actual field information that is used. smf_cf_forms contains the data that is in the post to the forums.

smf_cf_forms.sql
1e Form ID     Form Number /index.php?action=form;id=
2e Board ID    Forum Board Number /index.php?board=
3e Title     Form Name
4e template_function    Custom Template Function
5e subject     Subject     Subject of the post in the forum board
6e output     Form Output: The content of the post in the forum board

smf_cf_fields.sql
1e Field ID     Form Fields      in sequential order
2e Form ID     Form Number /index.php?action=form;id=
3e title     Title     This is how the field is listed in the fourm output ex. {name}
4e text     Text     This is the question or comment in the Form
5e type     Type    Text Box, Check Box, Selection Box, etc.
6e type_vars     Extra Type Parameters such as required in a Text Box

Pay close attention to ID_FIELD and ID_FORM. Attaching the wrong field to the wrong form could really get you confused especially if you have a lot of both.

Hope this helps you.

Nvb

Oh wow, useful info.

Since the fields stay the same for each form, i think i only need to change the froms.sql
I'll try to alter the forms.sql, but leave the fields.sql like it is.
The only thing i need to change is the board id and description.

I'll keep you posted if it works...

Garou

I don't think it will because the the way the fields.sql stores the info remember I said it was sequential.

Field      Form
1           1
2           1
3           1
4           2
5           2
6           2

Field 1 and field 4 could both be the same question  but if you try to change it to field 1 form 2, form 1 no longer accesses field 1.

wgfinley

I'm using the DarkBreak theme from Dziner Studios and recently installed Beta 4.  Things were fine with Beat 3 with the mod and my theme but after I upgraded I'm getting an error when I try to reinstall the mod.  The error is as follow:

3.  Execute Modification  ./Sources/Admin.php  Test failed
1. Add After ./Sources/Admin.php Test successful
2. Add After ./Sources/Admin.php Test failed


When I click on the detail I get this:


Find [Select]

// Load the language and templates....
loadLanguage('Admin');
loadTemplate('Admin');

Add After [Select]

loadLanguage('Modifications');



I have not reinstalled the mod because I don't want to screw anything up and the forms aren't used that much for me to risk it.  Any thoughts on what the issue is?

Thanks.

--Guy

Garou

I haven't tried any of the 2.0 betas yet. I'm a big supporter of Tiny Portal and they haven't  converted their mod to 2.0 yet.

That said, I didn't think it was supposed to happen with 2.0 but it looks like conflicting mods. You'll most likely have to edit the admin.php by hand.

My best guess is open ./Sources/Admin.php and search for loadTemplate('Admin'); then on the next line enter loadLanguage('Modifications');

Conflicting mods seem to be the bane of SMF modification and Manual Installation of Mods is your best friend. Custom Form Mod - Installation Instructions for 2.0 Beta 4 should be a big help too.  :)

the.basement

Quote from: LHVWB on November 24, 2008, 03:52:28 AM

@the.basement,
After reading through your post, I can't say that I have any idea what you issue actually is. Do you still require assistance?


Yep i do.
maybe i did not find it in this post, but
if i place a checkbox my formtemplate the makeup is messed up.
is there a little input or change i can make to leave the template intact.
second, if i want to make a new layout {customForm.template.php} on a new form,
how to handel. {multi form layouts}?

ps for the first thing i found the required "bug" but can't find this one why the checkbox change the layout.
the rest is working fine for me.

Garou

the.basement,
I noticed in the package you had uploaded here that it was based off a older version of the mod. That could be part of your problem. Uninstall the package you have and download the new one here. Then you will have to add the fix for the required bug.

That should fix the check box issue your having.

You can have multiple form layouts in the customForm.template.php.

Copy code from the default one named function form_template_submit_form() and rename it to whatever you want to call yours by, for example form_template_formname1() or form_template_formname2() etc. then place each before the ?> in the customForm.template.php.

Then in the admin panel in the Custom Form Mod Settings in the field named Custom Template Function enter formname1 or formname2 it will use that template instead of the default. You can have as many templates for your forms as you wish.

the.basement

#352
Quote from: Garou on November 27, 2008, 09:39:15 PM
the.basement,
I noticed in the package you had uploaded here that it was based off a older version of the mod. That could be part of your problem. Uninstall the package you have and download the new one here.



The template is simple to do.
This is what i did !
Copy/past the normal template to a other theme and give in the admin-panel the link to it.
That is what i did, maybe i had to because the older version.

greetings from
the

edit....................
watch out on my version uninstaller bug, have to manual rollback this function!
sorry! (old version it is)

BUT....
i have the hole thing updated cleaned out but still the checkbox is not correct it is on one line not under each other?
Also the required box is in line, see attach?
help????
i installed this one and updated the required box:
http://www.simplemachines.org/community/index.php?topic=248871.300   from LHVWB


Garou

Take a look at the example template I posted earlier.

Notice the line...
                <td colspan="3"  class="windowbg2" style="text-align:center">
The forms use a three column table and you have to compensate for that.
The line above should help to bring everything back in line. I had that issue as well and it took me a while to figure it out but that should fix it.

If it doesn't fix it, post your template and we will see if we cant figure it out. It could also be the theme you're using but we should be able to work around that.

fords8

#354
Quote from: wgfinley on November 27, 2008, 10:38:09 AM
I'm using the DarkBreak theme from Dziner Studios and recently installed Beta 4.  Things were fine with Beat 3 with the mod and my theme but after I upgraded I'm getting an error when I try to reinstall the mod.  The error is as follow:

3.  Execute Modification  ./Sources/Admin.php  Test failed
1. Add After ./Sources/Admin.php Test successful
2. Add After ./Sources/Admin.php Test failed


When I click on the detail I get this:


Find [Select]

// Load the language and templates....
loadLanguage('Admin');
loadTemplate('Admin');

Add After [Select]

loadLanguage('Modifications');



I have not reinstalled the mod because I don't want to screw anything up and the forms aren't used that much for me to risk it.  Any thoughts on what the issue is?

Thanks.

--Guy

I was just trying to install this in SMF2 Beta 4 and got the same error. So I looked the error up in the admin.php file from the file from the zip (smf_2-0-beta4p_install.zip) . The file from the zip is as followed:

// Load the language and templates....
loadLanguage('Admin');
loadTemplate('Admin', 'admin');


The mod is looking for this when it trys to install:

// Load the language and templates....
loadLanguage('Admin');
loadTemplate('Admin');


The mod install looks to be wrong.

EDIT: I changed the modifications_smfv2.xml file and zipped it back up and the install went find.

EDIT AGAIN: I just noticed that this mod is only for 1.1.5 and 2.0 Beta 3.1 Public. And not for SMF2 Beta 4.

Propaganistas

Quote from: LHVWB on November 24, 2008, 03:52:28 AM
@Propaganistas,
I am not familiar with that mod, could you please post your 'ModSettings.php' and 'Subs-Post.php' file, so that I can have a look over them?

Thanks for your reply!

Files are in attachment :)

Greetz
Propa



the.basement

Quote from: Garou on November 28, 2008, 11:03:44 PM
Take a look at
If it doesn't fix it, post your template and we will see if we cant figure it out. It could also be the theme you're using but we should be able to work around that.

That's what i found out also.  (i the beginning of the code it's in the colspan)
it's a fresh install no changes are made for this moment.
(for testing the form i did take the standard theme, also place this line in you never know maybe the tip works.)
Also in the standard theme gives it the same problem, sadly same thing.
attach is placed maybe you see something i did not see!
and if it's a very hard bug i demolish the checkbox out of this form.
Then i only use the selectionbox, gives alsmost the same output.
(bbc-code i can use no more, bbc not used in test form only yes,no in it)


the.basement

#357
Quote from: Propaganistas on November 29, 2008, 07:08:03 AM

Files are in attachment :)

Greetz
Propa

The mod was not installed on this.
did it by hand for you only i need the index.php also it loction is the upper folder.
make a copy of the original also, than place this one in.( other name and place ect., you know)
index has to be changed also!
maybe if this is installed correct the other error is no more in your error log.
8)

Garou

the.basement The template you sent was the one that comes with the install. I pot it on my server and created a form with two check boxes on the "SMF Default Theme - Core", it displays just fine.  Attached is the way it displays on my server.

There must be something else on your server that is causing the problem. When I had that problem on my server it was because I didn't account for the columns when I made my custom template. Once I did account for columns the problem was fixed.

If you haven't tried to customize your template, you shouldn't be having problems on the default theme. I have no idea what could be causing this problem for you.

the.basement

Quote from: Garou on November 29, 2008, 07:48:35 PM
If you haven't tried to customize your template, you shouldn't be having problems on the default theme. I have no idea what could be causing this problem for you.

well i have no idea also?
Maybe i put a wrong input of this box, what did you fill in this box.
i did .........     yes,no          ................           1,2          ...........
correct!

Advertisement: