MyBB Community Forums

Full Version: Automatic addiction dats to title of topic
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Code from http://www.mybboard.pl/automatycznie-dod...l#pid12293

1.Open File inc/datahandlers/post.php
2.Search

		// Inserting a new thread into the database.
		else
		{
			$this->thread_insert_data = array(
				"fid" => $thread['fid'],
				"subject" => $db->escape_string($thread['subject']),
i change to
		// Inserting a new thread into the database.
		else
		{
			$this->thread_insert_data = array(
				"fid" => $thread['fid'],
				"subject" => $db->escape_string('['.date("d.m.Y",intval($thread['dateline'])).'] '.$thread['subject']),

How I can change this code ? I want to when I write new posts , in place of title of topics shows date automatically.

edit: I found this one, but I don't now how add this to windows with name of topic

Pattern newthread

I found <td class="trow2" width="20%"><strong>{$lang->thread_subject}</strong></td>
<td class="trow2"><input type="text" class="textbox" name="subject" size="40" maxlength="85" value="{$subject}" tabindex="1" /></td>

Next I added <script language="JavaScript"><!--
var date = new Date();
var d = date.getDate();
var day = (d < 10) ? '0' + d : d;
var m = date.getMonth() + 1;
var month = (m < 10) ? '0' + m : m;
var yy = date.getYear();
var year = (yy < 1000) ? yy + 1900 : yy;

document.write(day + "." + month + "." + year);
//--></script>

This shows that:

<td class="trow2" width="20%"><strong>{$lang->thread_subject}</strong></td>
<td class="trow2"><script language="JavaScript"><!--
var date = new Date();
var d = date.getDate();
var day = (d < 10) ? '0' + d : d;
var m = date.getMonth() + 1;
var month = (m < 10) ? '0' + m : m;
var yy = date.getYear();
var year = (yy < 1000) ? yy + 1900 : yy;

document.write(day + "." + month + "." + year);
//--></script><input type="text" class="textbox" name="subject" size="40" maxlength="85" value="{$subject}" tabindex="1" /></td>


When I do it that , this shows that :

[Image: 534062efekt.png]

Can you tell me where I should add this script to in windows shows ' Name of topics'
Your script is placing your date next to the textarea, not in it. For the script to be inside, you'll need to replace the value property (see where {$subject} is now).

I've never tried putting javascript into a value tag, so I don't know whether it will work. You could always change $subject in newthread.php to show the date however, if the above doesn't work.