News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Pre filled message content - Possible?

Started by Gobo, September 30, 2006, 10:17:31 AM

Previous topic - Next topic

Gobo

Hi

If you visit dynamicdrive forums you will notice that on their support board when you compose a message the message body automatically contains some text as shown below:



Is this possible to do on SMF as well only for specific boards?

If yes then how?

Thanks,
Aku

codenaught

Themes/theme_name/Post.template.php:

// Finally the most important bit - the actual text box to write in!
echo '
<tr>
<td valign="top" align="right"></td>
<td>
<textarea class="editor" name="', $context['post_box_name'], '" rows="', $context['post_box_rows'], '" cols="', $context['post_box_columns'], '" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);" onchange="storeCaret(this);" tabindex="', $context['tabindex']++, '"', isset($context['post_error']['no_message']) || isset($context['post_error']['long_message']) ? ' style="border: 1px solid red;"' : '', '>', $message, '</textarea>
</td>
</tr>';


Change to something like (Changing the needed info added to that code to what you want):

// Finally the most important bit - the actual text box to write in!
echo '
<tr>
<td valign="top" align="right"></td>
<td>
<textarea class="editor" name="', $context['post_box_name'], '" rows="', $context['post_box_rows'], '" cols="', $context['post_box_columns'], '" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);" onchange="storeCaret(this);" tabindex="', $context['tabindex']++, '"', isset($context['post_error']['no_message']) || isset($context['post_error']['long_message']) ? ' style="border: 1px solid red;"' : '', '>', $context['current_board'] == 1 ? '1) Script Title:
2) More Stuff:' : '' .' ', $message, '</textarea>
</td>
</tr>';
Dev Consultant
Former SMF Doc Coordinator

Gobo


Gobo

ok tested and it works but 1 issue:

all replies contain the same prefilled content

is it possible to only specify it for the 1st post?

thanks

codenaught

Try this then:

// Finally the most important bit - the actual text box to write in!
echo '
<tr>
<td valign="top" align="right"></td>
<td>
<textarea class="editor" name="', $context['post_box_name'], '" rows="', $context['post_box_rows'], '" cols="', $context['post_box_columns'], '" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);" onchange="storeCaret(this);" tabindex="', $context['tabindex']++, '"', isset($context['post_error']['no_message']) || isset($context['post_error']['long_message']) ? ' style="border: 1px solid red;"' : '', '>', $context['current_board'] == 1 && $context['is_first_post'] ? '1) Script Title:
2) More Stuff:' : '' .' ', $message, '</textarea>
</td>
</tr>';


Haven't been able to test it but I imagine it should work.
Dev Consultant
Former SMF Doc Coordinator

Gobo

#5
works great!!!

Thank you so much!!

just one more final question:

how can i adapt this to work for multiple boards?

codenaught

Change the bit of code to:

$which_boards = array(1,2,3);

// Finally the most important bit - the actual text box to write in!
echo '
<tr>
<td valign="top" align="right"></td>
<td>
<textarea class="editor" name="', $context['post_box_name'], '" rows="', $context['post_box_rows'], '" cols="', $context['post_box_columns'], '" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);" onchange="storeCaret(this);" tabindex="', $context['tabindex']++, '"', isset($context['post_error']['no_message']) || isset($context['post_error']['long_message']) ? ' style="border: 1px solid red;"' : '', '>', in_array($context['current_board'],$which_boards) && $context['is_first_post'] ? '1) Script Title:
2) More Stuff:' : '' .' ', $message, '</textarea>
</td>
</tr>';
}


Adding the board ids you want to the $which_boards array at the top of the code.
Dev Consultant
Former SMF Doc Coordinator

Gobo

ooohhh man i love u!!

thanks so much

PS: I think this would be a good topic in tips & tricks board :D

codenaught

Glad you like it. :)

Fair enough. Moved to tips and tricks. :)
Dev Consultant
Former SMF Doc Coordinator

Corrupter

#9
Now what about doing this for posts made using the post event function under the calendar, i would imagine it has something to do with making those additions up under the // Are you posting a calendar event? section but i cant figure out where to put it or even if its worded the same.

i tried tinkering with board id's but i dont get it to work.

Nevermind i must of mistyped the board id for the calendar or didnt refresh before, its working now with board id of 0 for the calendar posting.

Although im sure it would be a neat trick to add it to the calendar event? section.

sweetdeath

How can it be avoid that the pre filled message will be add again if somebody edit the first post?

Gobo

oh by the way i forgot to say now there is a whole mod been developed by Thurnok down at Tiny Portal for this using Database to store entries for multiple boards
check it out below:
http://www.tinyportal.net/smf/index.php?topic=9419.0

you can post for support questions regarding that in that thread over at tiny portal if you want :)

L.G.S

Sorry if it's not supposed to be in here, but it seems it should:

How would I have an image in the background of quick reply and normal reply boxes?
FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


Gobo

yup its definately not supposed to be in here

u would have better luck at getting an answer if u start a new thread and title it something like "using a background image for reply boxes - possible?"

maybe someone has the answer

L.G.S

Yeah I know what to put in the topic.. I just put it in here because it was still related to filling the post boxes up before a post..
FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


eleven0


codenaught

Quote from: Eleven0 on October 11, 2007, 03:46:43 PM
Does version matter?
The code to search for appears to be the same in the latest version, so it should still work with SMF 1.1.4.
Dev Consultant
Former SMF Doc Coordinator

eleven0

What would I change to have this on multiple boards with different pre-filled content on each?

Rumbaar

"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

franklinrony

http://twitter.com/franklinrony

Entra y aprende a ser un webmaster
www.sv-blog.com
--Si pides ayuda al menos agradece el soporte recibido----

Advertisement: