Customizing SMF > SMF Coding Discussion

Filled message body

(1/4) > >>

ѕησω:
Oh hi, it's been a while I know.

Does anybody know a trick that fills the message body when creating a new topic with pre defined content?

So if somebody made a new topic, in the message field would appear something like this:


--- Code: ---[b]Name[/b] -
[b]Location[/b]
--- End code ---
-

Than the person can just fill in the blanks?

Suki:
You could do it with Jquery and append the content on the texarea or you can modify GenericControls.template.php or something like that

  that's where the textarea is actually created, I actually have a mod that did just that, I just haven't find time to actually update it.

Labradoodle-360:
jQuery is a good method, although it's also client side. If you wish to do this server side, you can use some markup, and a little PHP.

Something like this...would work.

--- Code: --->', isset($_REQUEST['predefined_body']) ? "[b]Name[/b] - \n[b]Location[/b] -" : '', '</textarea>
--- End code ---

ѕησω:
Thanks for your suggestions guys :) I still gotta check the mod site for some new cool toys :P

Would that code you posted go in GenericControls.template.php too Lab?

Labradoodle-360:
I made a couple new modifications, and I have a couple more coming in the next couple months, we'll see how it goes I suppose.

Yeah, it'd go inside the <textarea></textarea> tag, which is why I included some of it to hint to that :)

Navigation

[0] Message Index

[#] Next page

Go to full version