News:

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

Main Menu

[MOD-RC2] Topic Descriptions

Started by Kirby, October 24, 2004, 10:24:49 PM

Previous topic - Next topic

Kirby

Outdated....

Anguz

Cool. I'll check it out in a moment.

BTW, you can use .mod files in the package manager too. For an example, get my Faster Parsecode mod and see how it's done. ;)
Cristián Lávaque http://cristianlavaque.com

edi67

help me i made all but making UPGRADE to DB i had this result:

Connected successfully
Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/forumzo4/public_html/DBQuery.php on line 20


what i must make ?
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

Oldiesmann

You're getting that message because $query isn't a MySQL result set. $query is just a string to PHP and MySQL. In this case, you can just try to execute the query with a single line of code, and you don't really need to try to free up any memory used by $query because you're not going to be using it anywhere else anyway, and the file is done executing after that.

<?php
// ------------------------------------------------------------------------- //
// Topic Descriptions MySQL query                              //
// ------------------------------------------------------------------------- //

require_once('Settings.php');


// Connecting, selecting database
$link mysql_connect($db_server$db_user$db_passwd)
   or die(
'Could not connect: ' mysql_error());
echo 
'Connected successfully';
mysql_select_db($db_name) or die('Could not select database');

// Performing SQL query
$query mysql_query("ALTER TABLE `{$db_prefix}topics` ADD `description` TEXT NOT NULL FIRST ;") or die(mysql_error());

// Closing connection
mysql_close($link);
?>
Michael Eshom
Christian Metal Fans

Kirby

#4
Quote from: Anguz on October 24, 2004, 11:25:57 PM
Cool. I'll check it out in a moment.

BTW, you can use .mod files in the package manager too. For an example, get my Faster Parsecode mod and see how it's done. ;)
Hmm, interesting, I'll take a look at that :)

And thanks Oldiesmann & edi67, I'll update it now...
EDIT: fixed another small issue <_<

edi67

#5
Fantastic Kirby it work perfectly  :D

thank again this was one of 2 mod that i loved

only one little problem as u can see in messageindex number of page in post is double look pic.

CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

Kirby

#6
Oops! I'll fix that right now, thanks edi!
EDIT: fixed, remove the second (if there) "<span class="smalltext">', $topic['pages'], '</span>"

edi67

excellent now

super mod grazie

ps. one little question will be nice to see the description of topic after title topic may be separate by one "," opening the topic ..i dont know if u can understand me but for example in invision when u read one topic with description of topic i will see the description after title of topic as in this pic look.

messageindex.




and opening the topic



this can be onlyh one idea because yuour mod is already excellent for me
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

Oldiesmann

In Sources/Display.php

Find
// Get all the important topic info.
$request = db_query("
SELECT
t.numReplies, t.numViews, t.locked, ms.subject, t.isSticky, t.ID_POLL, t.ID_MEMBER_STARTED,
IFNULL(lt.logTime, 0) AS logTime, t.ID_FIRST_MSG
FROM {$db_prefix}topics AS t, {$db_prefix}messages AS ms
LEFT JOIN {$db_prefix}log_topics AS lt ON (lt.ID_TOPIC = $topic AND lt.ID_MEMBER = $ID_MEMBER)
WHERE t.ID_TOPIC = $topic
AND ms.ID_MSG = t.ID_FIRST_MSG
LIMIT 1", __FILE__, __LINE__);


Replace
// Get all the important topic info.
$request = db_query("
SELECT
t.numReplies, t.numViews, t.locked, t.description,  ms.subject, t.isSticky, t.ID_POLL, t.ID_MEMBER_STARTED,
IFNULL(lt.logTime, 0) AS logTime, t.ID_FIRST_MSG
FROM {$db_prefix}topics AS t, {$db_prefix}messages AS ms
LEFT JOIN {$db_prefix}log_topics AS lt ON (lt.ID_TOPIC = $topic AND lt.ID_MEMBER = $ID_MEMBER)
WHERE t.ID_TOPIC = $topic
AND ms.ID_MSG = t.ID_FIRST_MSG
LIMIT 1", __FILE__, __LINE__);


Find
// Set the topic's information for the template.
$context['subject'] = $topicinfo['subject'];
$context['num_views'] = $topicinfo['numViews'];


Add after
$context['description'] = $topicinfo['description'];

In Themes/default/Display.template.php

Find
// Show the topic information - icon, subject, etc.
echo '
<table width="100%" cellpadding="3" cellspacing="0" border="0" class="tborder" style="border-bottom: 0;">
<tr class="titlebg">
<td valign="middle" align="left" width="15%" style="padding-left: 6px;">
<img src="', $settings['images_url'], '/topic/', $context['class'], '.gif" alt="" align="middle" /> ', $txt[29], '
</td>
<td valign="middle" align="left" width="85%" style="padding-left: 6px;">
', $txt[118], ': ', $context['subject'], ' &nbsp;(', $txt[641], ' ', $context['num_views'], ' ', $txt[642], ')
</td>
</tr>
</table>';


Replace
// Show the topic information - icon, subject, etc.
echo '
<table width="100%" cellpadding="3" cellspacing="0" border="0" class="tborder" style="border-bottom: 0;">
<tr class="titlebg">
<td valign="middle" align="left" width="15%" style="padding-left: 6px;">
<img src="', $settings['images_url'], '/topic/', $context['class'], '.gif" alt="" align="middle" /> ', $txt[29], '
</td>
<td valign="middle" align="left" width="85%" style="padding-left: 6px;">
', $txt[118], ': ', $context['subject'], ', ', $context['description'], ' &nbsp;(', $txt[641], ' ', $context['num_views'], ' ', $txt[642], ')
</td>
</tr>
</table>';
Michael Eshom
Christian Metal Fans

Kirby

#9
What if there is no description? :P It would add a comma for nothing..
Use the same code Oldiesmann used, except for the
Quote<td valign="middle" align="left" width="85%" style="padding-left: 6px;">
', $txt[118], ': ', $context['subject'], ', ', $context['description'], ' &nbsp;(', $txt[641], ' ', $context['num_views'], ' ', $txt[642], ')
</td>

Replace it with
Quote<td valign="middle" align="left" width="85%" style="padding-left: 6px;">
', $txt[118], ': ', $context['subject'];

if ($context['description'] != '')
echo '
, ', $context['description'];

echo ' &nbsp;(', $txt[641], ' ', $context['num_views'], ' ', $txt[642], ')
</td>';

That should work..

Oldiesmann

I forgot about that. Besides - isn't that the way IPB does it? :)
Michael Eshom
Christian Metal Fans

codenaught

Nice mod. Works well. Thank you.  :)
Dev Consultant
Former SMF Doc Coordinator

Kirby

Quote from: Oldiesmann on October 27, 2004, 08:12:42 PM
I forgot about that. Besides - isn't that the way IPB does it? :)
Not sure, I think it removes it :S

Quote from: akabugeyes on October 27, 2004, 09:05:40 PM
Nice mod. Works well. Thank you. :)
Thank you

edi67

again thx for this great mod but i want u tell about one little little bug

making one new thread u insert all data, title, description, and all if u want see the preview before post it u will see all correct but the field description will be deleted and u must rewrite the description

i want ask if is normal that description go out if u see the preview or may be there is one way to fix it

thx anyway
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

Oldiesmann

Sure... Unfortunately I can't give you specific instructions at the moment because I can't get to that site ("kirbu.lod-squared.com could not be found. Please check the name and try again."), but here's how:

In Themes/default/Post.template.php

Find:
<input type="text" name="description"

Replace:
<input type="text" name="description"', $context['description'] == '' ? '' : ' value="' . $context['description'] . '"', '

Don't mess with the rest of the input tag there and make sure there's a space after that '
Michael Eshom
Christian Metal Fans

Kirby

Sorry about that, my host is down at the moment.

edi67

sorry but there are 2 of this line which one i must modify:

Quoteif ($context['is_new_topic'] && $modSettings['descr_allow'] == '1')
                {
         echo '
                     <tr>
                        <td align="right">
                           <b>',$txt['Topic_Description'],'</b>
                        </td>
                        <td>
                           <input type="text" name="description" size="80" maxlength="80" tabindex="1" />
                        </td>
                     </tr>';
      }
                elseif ($context['is_first_post'] && $modSettings['descr_allow'] == '1' && isset($_REQUEST['msg']))
                {
         echo '
                     <tr>
                        <td align="right">
                           <b>',$txt['Topic_Description'],'</b>
                        </td>
                        <td>
                           <input type="text" name="description" value="' . $context['description'] . '" size="80" maxlength="80" tabindex="1" />
                        </td>
                     </tr>';
      }
                     echo '
                     <tr>
                        <td align="right">
                           <b>', $txt[71], ':</b>
                        </td>
                        <td>
                           <select name="icon" id="icon" onchange="showimage()">';
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

[Unknown]

if (!empty($modSettings['descr_allow']))
                {
echo '
<tr>
<td align="right">
<b>', $txt['Topic_Description'], '</b>
</td>
<td>
<input type="text" name="description" value="' . @$context['description'] . '" size="80" maxlength="80" tabindex="1" />
</td>
</tr>';
}
echo '
<tr>
<td align="right">
<b>', $txt[71], ':</b>
</td>
<td>
<select name="icon" id="icon" onchange="showimage()">';


-[Unknown]

edi67

CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

edi67

u can explain me better unknwon cause if i made your modifiy i see 2 field description making post but my problem is that if i make preview words in description field go out and i must rewrite
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

Advertisement: