TinyPortal

Development => Block Codes => Topic started by: shengton on September 26, 2008, 09:26:11 AM

Title: [BLOCK] Unanswered Topics Block
Post by: shengton on September 26, 2008, 09:26:11 AM
Hello guys, good day. :)

I searched awhile ago and I didn't find what I need. I need a block/script that instead of Recent Topics that will be displayed in. I want to change it to Unanswered Topics instead of Recent Topics. I can't see any type of block type. I want to put is in my Homepage right panel. So I think a script can do the job.

I need a script that will display Unanswered Topics.

I'm using SMF software.

Hope you can help me with this. I really really need it.

Thanks and God bless. :)
Title: Re: Unanswered Topics Block
Post by: Ken. on September 26, 2008, 10:16:45 AM
Please read the Posting Guidelines.html (http://www.tinyportal.net/index.php/topic,581)
SHENGTON, if you'll follow the posting guidelines and give us the info called for it will be lots easier for our code snippets specialists to help you. :)
Title: Re: Unanswered Topics Block
Post by: shengton on September 27, 2008, 06:01:57 AM
Sorry Sir...Thanks for reminding me with the guidelines.

Can I request a script for Unanswered Topics. Please I really need it.
Title: Re: Unanswered Topics Block
Post by: JPDeni on September 30, 2008, 03:34:43 PM
I tried to make it, but couldn't work it out. It should be easy, but my brain doesn't seem to be working. I'll try again later.
Title: Re: Unanswered Topics Block
Post by: JPDeni on September 30, 2008, 04:34:01 PM
Okay. Let's try this again.


global $db_prefix, $scripturl, $user_info;

$number_to_display = 10; // Change this if you want a different number to display. Use 0 to list all of them.
$most_recent_first = 1; // If you want to display the oldest first, change this to 0

//////////////////////////////////////////

($most_recent_first == 1) ? $order = 'DESC' : $order = 'ASC';
($number_to_display == 0) ? $limit = '' : $limit = "LIMIT " . $number_to_display;

$query = db_query(
"SELECT m.subject, t.ID_TOPIC
FROM {$db_prefix}topics as t, {$db_prefix}messages as m, {$db_prefix}boards AS b
WHERE t.numReplies = 0
AND t.ID_FIRST_MSG = m.ID_MSG
AND t.ID_BOARD = b.ID_BOARD
AND $user_info[query_see_board]
ORDER BY t.ID_FIRST_MSG " . $order . ' ' .
$limit, __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($query))
  echo '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '">' . $row['subject'] . '</a><br />';

Title: Re: Unanswered Topics Block
Post by: Ianedres on September 30, 2008, 05:13:18 PM
Most excellent! Good work there.

Ooh. Ternary operator... :o
Title: Re: Unanswered Topics Block
Post by: JPDeni on September 30, 2008, 05:24:46 PM
Thanks! The problem I had at first was using $user_info['query_see_board'] incorrectly. I figured if I didn't include it, someone would come along and request it.

QuoteOoh. Ternary operator...

My education is very spotty, so I'm not sure exactly what that means. Are you referring to


($most_recent_first == 1) ? $order = 'DESC' : $order = 'ASC';


I love those! :D I just found out that some programmers think they're bad form. To me, they make logical sense. And they're tidy. I like tidiness. ;)
Title: Re: Unanswered Topics Block
Post by: Ianedres on September 30, 2008, 05:37:05 PM
May I suggest this to not list the deleted posts, but only the valid posts...

global $db_prefix, $scripturl, $user_info, $modSettings;

$number_to_display = 10; // Change this if you want a different number to display. Use 0 to list all of them.
$most_recent_first = 1; // If you want to display the oldest first, change this to 0

if(!empty($modSettings['recycle_enable'])) $recycle_board = $modSettings['recycle_board'];

//////////////////////////////////////////

($most_recent_first == 1) ? $order = 'DESC' : $order = 'ASC';
($number_to_display == 0) ? $limit = '' : $limit = "LIMIT " . $number_to_display;

$query = db_query(
"SELECT m.subject, t.ID_TOPIC
FROM {$db_prefix}topics as t, {$db_prefix}messages as m, {$db_prefix}boards AS b
WHERE t.numReplies = 0
AND t.ID_FIRST_MSG = m.ID_MSG
AND t.ID_BOARD = b.ID_BOARD
AND $user_info[query_see_board]
AND b.ID_BOARD != $recycle_board
ORDER BY t.ID_FIRST_MSG " . $order . ' ' .
$limit, __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($query))
  echo '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '">' . $row['subject'] . '</a><br />';
Title: Re: Unanswered Topics Block
Post by: Ianedres on September 30, 2008, 05:45:21 PM
I first came across the ternary (aka trinary) operator while perusing through Bloc's code for TP.

I couldn't make head or tails of what was happening at the time, and it is hard to find an explanation on php.net (http://www.php.net/manual/en/language.operators.comparison.php) about it, since it uses "?" as a name.

And whether it is considered proper or not, I like to use it whenever practical.

Title: Re: Unanswered Topics Block
Post by: IchBin on September 30, 2008, 07:27:25 PM
The ternary statement is widely used in many languages. Anyone who says it is sloppy should have their eyes examined. lol
Title: Re: Unanswered Topics Block
Post by: JPDeni on September 30, 2008, 07:46:06 PM
QuoteMay I suggest this to not list the deleted posts, but only the valid posts...

Good job! I had thought about the recycle bin problem, but then forgot while I was doing something else.
Title: Re: Unanswered Topics Block
Post by: Ianedres on September 30, 2008, 08:48:58 PM
If you're through with the block, why not change the subject line with [block] to make it appear in the recent blocks...   ;)

@ Ich - I am all for using organized code and the ternary doesn't bother me (now that I know what it is!)...

This could be a very useful tool for admins/moderators to help monitor and keep their boards active.
Title: Re: Unanswered Topics Block
Post by: JPDeni on September 30, 2008, 09:38:16 PM
Quotewhy not change the subject line with [block] to make it appear in the recent blocks.
Will do. :)

(Just poke me if I forget something. My brain still is in a fog.)
Title: Re: [BLOCK] Unanswered Topics Block
Post by: shengton on October 01, 2008, 04:34:17 PM
Hi Sir JPDeni, good day.

Thanks for the codes Sir and I really appreciate your effort. I noticed something, the topics that are already moved are included. I'm talking about the "MOVED: SubjectTitle"

QuoteThis topic has been moved to Applications.

http://www.pc-forums.org/forum/index.php?topic=4967.0

The Reported Topics and Deleted Topics are also included in the block which is not right.

Hope you can help me with this Sir JPDeni.

Thanks and God bless. :)
Title: Re: [BLOCK] Unanswered Topics Block
Post by: Ken. on October 01, 2008, 05:39:05 PM
Quote from: SHENGTON on October 01, 2008, 04:34:17 PM
Hi Sir JPDeni, good day.
Thanks and God bless. :)

Actually JP is not a "Sir", but she is most definitely a Lady. :)
Title: Re: [BLOCK] Unanswered Topics Block
Post by: JPDeni on October 01, 2008, 06:25:23 PM
Try this:


global $db_prefix, $scripturl, $user_info, $modSettings;

$number_to_display = 10; // Change this if you want a different number to display. Use 0 to list all of them.
$most_recent_first = 1; // If you want to display the oldest first, change this to 0

if(!empty($modSettings['recycle_enable'])) $recycle_board = $modSettings['recycle_board'];

//////////////////////////////////////////

($most_recent_first == 1) ? $order = 'DESC' : $order = 'ASC';
($number_to_display == 0) ? $limit = '' : $limit = "LIMIT " . $number_to_display;

$query = db_query(
"SELECT m.subject, t.ID_TOPIC
FROM {$db_prefix}topics as t, {$db_prefix}messages as m, {$db_prefix}boards AS b
WHERE t.numReplies = 0
AND t.ID_FIRST_MSG = m.ID_MSG
AND t.ID_BOARD = b.ID_BOARD
AND $user_info[query_see_board]
AND b.ID_BOARD != $recycle_board
AND m.subject NOT LIKE '%MOVED:%'
ORDER BY t.ID_FIRST_MSG " . $order . ' ' .
$limit, __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($query))
  echo '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '">' . $row['subject'] . '</a><br />';


Iandres's addition to the code took care of deleted topics in a "recycle bin." I don't know how to not include reported topics.
Title: Re: [BLOCK] Unanswered Topics Block
Post by: shengton on October 02, 2008, 06:10:53 AM
Sorry I didn't know she's a woman.

Hi Maam JPDeni. :)

Looks ok now. The Reported Topics, Deleted Topics and the Moved Topics are already gone. But one more thing is, looks like there's no dot before the title of topic.

This is the output of your code:
Windows Vista
Linux is Great
Windows XP themes
Four Windows in one computer?
What is core?
What is Windows?
What is Processor?
True or False


I want to look like this:
o Windows Vista
o Linux is Great
o Windows XP themes
o Four Windows in one computer?
o What is core?
o What is Windows?
o What is Processor?
o True or False


The dot color either gray or skyblue. But it's up to you Maam if what colors should fit.

I really really appreciate your effort Maam and you're a good programmer. Hope you can help me with this.

Thanks and God bless. :)
Title: Re: [BLOCK] Unanswered Topics Block
Post by: IchBin on October 02, 2008, 06:17:50 AM
Change this:
while ($row = mysql_fetch_assoc($query))
  echo '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '">' . $row['subject'] . '</a><br />';


To this:
echo '<ul>';
while ($row = mysql_fetch_assoc($query))
  echo '<li><a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '">' . $row['subject'] . '</a></li>';
echo '</ul>';
Title: Re: [BLOCK] Unanswered Topics Block
Post by: shengton on October 02, 2008, 06:59:03 AM
Perfect...This is what I need...Yehey..Thanks guys. You're great programmers.

global $db_prefix, $scripturl, $user_info, $modSettings;

$number_to_display = 5; // Change this if you want a different number to display. Use 0 to list all of them.
$most_recent_first = 0; // If you want to display the oldest first, change this to 0

if(!empty($modSettings['recycle_enable'])) $recycle_board = $modSettings['recycle_board'];

//////////////////////////////////////////

($most_recent_first == 1) ? $order = 'DESC' : $order = 'ASC';
($number_to_display == 0) ? $limit = '' : $limit = "LIMIT " . $number_to_display;

$query = db_query(
"SELECT m.subject, t.ID_TOPIC
FROM {$db_prefix}topics as t, {$db_prefix}messages as m, {$db_prefix}boards AS b
WHERE t.numReplies = 0
AND t.ID_FIRST_MSG = m.ID_MSG
AND t.ID_BOARD = b.ID_BOARD
AND $user_info[query_see_board]
AND b.ID_BOARD != $recycle_board
AND m.subject NOT LIKE '%MOVED:%'
ORDER BY t.ID_FIRST_MSG " . $order . ' ' .
$limit, __FILE__, __LINE__);

echo '';
while ($row = mysql_fetch_assoc($query))
  echo '<img src="image url"> <a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '">' . $row['subject'] . ' <img src="image url"></a>';
echo '</ul>';
Title: Re: [BLOCK] Unanswered Topics Block
Post by: shengton on October 15, 2008, 03:42:11 AM
Guys I need your help again regarding this topic. I want to put an image "new" after the topic.

The output should be like this:
Quoteo Windows Vista (https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fwww.pcforums.yjobz.com%2Fforum%2FThemes%2FOutline_tp%2Fimages%2Fenglish%2Fnew.gif&hash=fce191be833c47b8495f38a3cad580714c786c78)
o Linux is Great (https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fwww.pcforums.yjobz.com%2Fforum%2FThemes%2FOutline_tp%2Fimages%2Fenglish%2Fnew.gif&hash=fce191be833c47b8495f38a3cad580714c786c78)
o Windows XP themes (https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fwww.pcforums.yjobz.com%2Fforum%2FThemes%2FOutline_tp%2Fimages%2Fenglish%2Fnew.gif&hash=fce191be833c47b8495f38a3cad580714c786c78)
o Four Windows in one computer? (https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fwww.pcforums.yjobz.com%2Fforum%2FThemes%2FOutline_tp%2Fimages%2Fenglish%2Fnew.gif&hash=fce191be833c47b8495f38a3cad580714c786c78)
o What is core? (https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fwww.pcforums.yjobz.com%2Fforum%2FThemes%2FOutline_tp%2Fimages%2Fenglish%2Fnew.gif&hash=fce191be833c47b8495f38a3cad580714c786c78)
o What is Windows? (https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fwww.pcforums.yjobz.com%2Fforum%2FThemes%2FOutline_tp%2Fimages%2Fenglish%2Fnew.gif&hash=fce191be833c47b8495f38a3cad580714c786c78)
o What is Processor? (https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fwww.pcforums.yjobz.com%2Fforum%2FThemes%2FOutline_tp%2Fimages%2Fenglish%2Fnew.gif&hash=fce191be833c47b8495f38a3cad580714c786c78)
o True or False (https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fwww.pcforums.yjobz.com%2Fforum%2FThemes%2FOutline_tp%2Fimages%2Fenglish%2Fnew.gif&hash=fce191be833c47b8495f38a3cad580714c786c78)

Hope you can help with this.

Thanks and God bless. :)
Title: Re: [BLOCK] Unanswered Topics Block
Post by: JPDeni on October 15, 2008, 04:21:12 AM
Put the img tag just before


</li>
Title: Re: [BLOCK] Unanswered Topics Block
Post by: shengton on October 15, 2008, 08:16:26 AM
Thanks Maam, it works.

Updated the code.

Here's the output:

(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fi168.photobucket.com%2Falbums%2Fu162%2FSHENGTON%2FUnanswered.jpg&hash=b1e9b94a715fe846d116e6faefed3415c70e53c0)
Title: Re: [BLOCK] Unanswered Topics Block
Post by: FERNSIDEâ„¢ on November 04, 2008, 10:36:27 PM
Hi SHENGTON,
for people such as myself that cannot tie their own shoelaces without a step by step manual :uglystupid2:, could you possibly publish your final code here please?

Thank You  :)
Title: Re: [BLOCK] Unanswered Topics Block
Post by: alhaudhie on November 08, 2008, 07:39:20 AM
Quote from: SHENGTON on October 02, 2008, 06:59:03 AM
Perfect...This is what I need...Yehey..Thanks guys. You're great programmers.

global $db_prefix, $scripturl, $user_info, $modSettings;

$number_to_display = 5; // Change this if you want a different number to display. Use 0 to list all of them.
$most_recent_first = 0; // If you want to display the oldest first, change this to 0

if(!empty($modSettings['recycle_enable'])) $recycle_board = $modSettings['recycle_board'];

//////////////////////////////////////////

($most_recent_first == 1) ? $order = 'DESC' : $order = 'ASC';
($number_to_display == 0) ? $limit = '' : $limit = "LIMIT " . $number_to_display;

$query = db_query(
"SELECT m.subject, t.ID_TOPIC
FROM {$db_prefix}topics as t, {$db_prefix}messages as m, {$db_prefix}boards AS b
WHERE t.numReplies = 0
AND t.ID_FIRST_MSG = m.ID_MSG
AND t.ID_BOARD = b.ID_BOARD
AND $user_info[query_see_board]
AND b.ID_BOARD != $recycle_board
AND m.subject NOT LIKE '%MOVED:%'
ORDER BY t.ID_FIRST_MSG " . $order . ' ' .
$limit, __FILE__, __LINE__);

echo '';
while ($row = mysql_fetch_assoc($query))
  echo '<img src="image url"> <a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '">' . $row['subject'] . ' <img src="image url"></a>';
echo '</ul>';


with this code above i have this result in my block

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND m.subject NOT LIKE '%MOVED:%'
ORDER BY t.ID_FIRST_MSG ASC LIMIT 5' at line 8
File: /home/mysite/public_html/v0/Sources/Load.php(1999) : eval()'d code(52) : eval()'d code
Line: 23
Title: Re: [BLOCK] Unanswered Topics Block
Post by: JPDeni on November 08, 2008, 04:26:20 PM
Do you have a recycle board ... one that all deleted posts are immediately transferred to? If not, remove


AND b.ID_BOARD != $recycle_board
Title: Re: [BLOCK] Unanswered Topics Block
Post by: JPDeni on November 08, 2008, 04:36:18 PM
I think this may be a better way to go with the code:


global $db_prefix, $scripturl, $user_info, $modSettings;

$number_to_display = 5; // Change this if you want a different number to display. Use 0 to list all of them.
$most_recent_first = 0; // If you want to display the oldest first, change this to 0

if(!empty($modSettings['recycle_enable'])) $recycle_board = $modSettings['recycle_board'];
else $recycle_board = 0;

//////////////////////////////////////////

($most_recent_first == 1) ? $order = 'DESC' : $order = 'ASC';
($number_to_display == 0) ? $limit = '' : $limit = "LIMIT " . $number_to_display;

$query = db_query(
"SELECT m.subject, t.ID_TOPIC
FROM {$db_prefix}topics as t, {$db_prefix}messages as m, {$db_prefix}boards AS b
WHERE t.numReplies = 0
AND t.ID_FIRST_MSG = m.ID_MSG
AND t.ID_BOARD = b.ID_BOARD
AND $user_info[query_see_board]
AND b.ID_BOARD != $recycle_board
AND m.subject NOT LIKE '%MOVED:%'
ORDER BY t.ID_FIRST_MSG " . $order . ' ' .
$limit, __FILE__, __LINE__);

echo '<ul>';
while ($row = mysql_fetch_assoc($query))
  echo '<li><a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '">' . $row['subject'] . '</a></li>';
echo '</ul>';


This should make it work whether you have a recycle board set or not.
Title: Re: [BLOCK] Unanswered Topics Block
Post by: alhaudhie on November 09, 2008, 04:08:03 AM
how about to make it random post?
Title: Re: [BLOCK] Unanswered Topics Block
Post by: JPDeni on November 10, 2008, 05:09:30 AM
Just a random post? There's code here to pull in a random post. If you want to make a random unanswered post, change


ORDER BY t.ID_FIRST_MSG " . $order . ' ' .


to


ORDER BY RAND()


and set the $number_to_display variable to 1.
Title: Re: [BLOCK] Unanswered Topics Block
Post by: alhaudhie on November 11, 2008, 12:22:24 PM
Having this after replace with

ORDER BY RAND()

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/myhome/public_html/v0/Sources/Load.php(1999) : eval()'d code(52) : eval()'d code on line 28

where is the variable setting must set up wih 1?
Title: Re: [BLOCK] Unanswered Topics Block
Post by: alhaudhie on November 15, 2008, 10:10:29 AM
Quote from: JPDeni on November 12, 2008, 02:28:19 PM
I'm so glad that you can access it. Other team members can, too, but for some reason I can't.

Okay. Here's the correct answer. Change


ORDER BY t.ID_FIRST_MSG " . $order . ' ' .
$limit, __FILE__, __LINE__);


to


ORDER BY RAND() " .
$limit, __FILE__, __LINE__);


That should give you what you want. I'm sorry I got it wrong before.


I hope this gets worked out soon.

Take care.

JPDeni

Thanks.. good working now...
Title: Re: [BLOCK] Unanswered Topics Block
Post by: JPDeni on November 15, 2008, 02:42:21 PM
Thank you for posting it! Now I can access the topic, but I appreciate your passing on the information when I couldn't.
Title: Re: [BLOCK] Unanswered Topics Block
Post by: alhaudhie on November 15, 2008, 05:12:09 PM
One thing..

when i change $number_to_display = 2; // Change this if you want a different number to display. Use 0 to list all of them.

The number 2 to 1 - thats give me soo much topics iin block. not only 1
Title: Re: [BLOCK] Unanswered Topics Block
Post by: JPDeni on November 15, 2008, 06:16:18 PM
Rather than using the variables, just use the values in the code:


$query = db_query(
"SELECT m.subject, t.ID_TOPIC
FROM {$db_prefix}topics as t, {$db_prefix}messages as m, {$db_prefix}boards AS b
WHERE t.numReplies = 0
AND t.ID_FIRST_MSG = m.ID_MSG
AND t.ID_BOARD = b.ID_BOARD
AND $user_info[query_see_board]
ORDER BY RAND()
LIMIT 1", __FILE__, __LINE__)
Title: Re: [BLOCK] Unanswered Topics Block
Post by: shengton on November 23, 2008, 07:29:57 AM
I have "Reported Posts" and "Reported Messages" sections. All reported posts and messages are included in the block. What code should I add so that it won't be included anymore in the block.

Hope you can help me with this.

Thanks and God bless.
Title: Re: [BLOCK] Unanswered Topics Block
Post by: JPDeni on November 23, 2008, 03:30:30 PM
I just looked over the SMF code and when a post is reported to a moderator, nothing is written to the database. If the information isn't stored, it can't be retrieved, so what you're asking for isn't possible without a substantial modification to SMF. That would be beyond my ability.
Title: Re: [BLOCK] Unanswered Topics Block
Post by: alhaudhie on November 24, 2008, 03:46:32 AM
tq.. nice work.

How about we add overflow sroll.

Like i want to put 50 posts but i want it show only 5 post. Others 45 post we must scroll it down to look it.
Title: Re: [BLOCK] Unanswered Topics Block
Post by: JPDeni on November 24, 2008, 05:12:42 AM
You can probably work out how to do that if you investigate css. Lots and lots of stuff about that on the 'net.
Title: Re: [BLOCK] Unanswered Topics Block
Post by: alhaudhie on November 24, 2008, 06:38:57 AM
Can we use like useronline code...

<div style="width: 100%; ' , $online['num_users']>14 ? 'height: 23ex;overflow: auto;' : '' ,'">';
Title: Re: [BLOCK] Unanswered Topics Block
Post by: JPDeni on November 24, 2008, 01:22:49 PM
Why don't you give it a try?
Title: Re: [BLOCK] Unanswered Topics Block
Post by: alhaudhie on November 25, 2008, 02:16:14 PM
i try this... but not success...

echo   ' <div style="width: 100%; ' ' <img src="http://tbn0.google.com/images?q=tbn:pQBIIcIWd2dZQM:http://i.pbase.com/u16/sutha/upload/5123820.bullet.jpg" /> <a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '">' . $row['subject'] . 'height: 23ex;overflow: auto;' : >';
Title: Re: [BLOCK] Unanswered Topics Block
Post by: IchBin on November 25, 2008, 02:28:14 PM
Put your image after the end of the <div>. Putting your image inside the div will not work like that.
You have it like this:
<div<img><a>></div>

It should be like this:
<div><img><a></div>
Title: Re: [BLOCK] Unanswered Topics Block
Post by: JPDeni on November 25, 2008, 03:28:19 PM
Before your topics print out, add this:

echo  '<div style="width: 100%; height: 23ex;overflow: auto>';

at the end of your code, add this

echo '</div>';
Title: Re: [BLOCK] Unanswered Topics Block
Post by: alhaudhie on November 26, 2008, 03:49:25 PM
i try this.. but not success

echo  '<div style="width: 100%; height: 23ex;overflow: auto>'; <img src="http://tbn0.google.com/images?q=tbn:pQBIIcIWd2dZQM:http://i.pbase.com/u16/sutha/upload/5123820.bullet.jpg" /> <a href="' . $scripturl . '?

topic=' . $row['ID_TOPIC'] . '">' . $row['subject'] . '</a></li><br>';

echo '</div>';
Title: Re: [BLOCK] Unanswered Topics Block
Post by: JPDeni on November 26, 2008, 03:59:23 PM
You'll need to post your whole code so I can show you where to put it.
Title: Re: [BLOCK] Unanswered Topics Block
Post by: alhaudhie on November 26, 2008, 04:09:31 PM
YES.. this is..


global $db_prefix, $scripturl, $user_info, $modSettings;

$number_to_display = 4; // Change this if you want a different number to display. Use 0 to list all of them.
$most_recent_first = 0; // If you want to display the oldest first, change this to 0

if(!empty($modSettings['recycle_enable'])) $recycle_board = $modSettings['recycle_board'];
else $recycle_board = 0;

//////////////////////////////////////////

($most_recent_first == 1) ? $order = 'DESC' : $order = 'ASC';
($number_to_display == 1) ? $limit = '' : $limit = "LIMIT " . $number_to_display;

$query = db_query(
"SELECT m.subject, t.ID_TOPIC
FROM {$db_prefix}topics as t, {$db_prefix}messages as m, {$db_prefix}boards AS b
WHERE t.numReplies = 0
AND t.ID_FIRST_MSG = m.ID_MSG
AND t.ID_BOARD = b.ID_BOARD
AND $user_info[query_see_board]
AND b.ID_BOARD != $recycle_board
AND m.subject NOT LIKE '%MOVED:%'
ORDER BY RAND() " .
$limit, __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($query))
  echo  '<div style="width: 100%; height: 23ex;overflow: auto>'; <img src="http://tbn0.google.com/images?q=tbn:pQBIIcIWd2dZQM:http://i.pbase.com/u16/sutha/upload/5123820.bullet.jpg" /> <a href="' . $scripturl . '?

topic=' . $row['ID_TOPIC'] . '">' . $row['subject'] . '</a></li><br>';

echo '</div>';
Title: Re: [BLOCK] Unanswered Topics Block
Post by: JPDeni on November 26, 2008, 04:13:30 PM

global $db_prefix, $scripturl, $user_info, $modSettings;

$number_to_display = 4; // Change this if you want a different number to display. Use 0 to list all of them.
$most_recent_first = 0; // If you want to display the oldest first, change this to 0

if(!empty($modSettings['recycle_enable'])) $recycle_board = $modSettings['recycle_board'];
else $recycle_board = 0;

//////////////////////////////////////////

($most_recent_first == 1) ? $order = 'DESC' : $order = 'ASC';
($number_to_display == 1) ? $limit = '' : $limit = "LIMIT " . $number_to_display;

$query = db_query(
"SELECT m.subject, t.ID_TOPIC
FROM {$db_prefix}topics as t, {$db_prefix}messages as m, {$db_prefix}boards AS b
WHERE t.numReplies = 0
AND t.ID_FIRST_MSG = m.ID_MSG
AND t.ID_BOARD = b.ID_BOARD
AND $user_info[query_see_board]
AND b.ID_BOARD != $recycle_board
AND m.subject NOT LIKE '%MOVED:%'
ORDER BY RAND() " .
$limit, __FILE__, __LINE__);

echo  '<div style="width: 100%; height: 23ex;overflow: auto>';

while ($row = mysql_fetch_assoc($query))
  echo '<img src="http://tbn0.google.com/images?q=tbn:pQBIIcIWd2dZQM:http://i.pbase.com/u16/sutha/upload/5123820.bullet.jpg" />
        <a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '">' . $row['subject'] . '</a><br>';

echo '</div>';
Title: Re: [BLOCK] Unanswered Topics Block
Post by: alhaudhie on November 26, 2008, 04:27:10 PM
i think this is not work. there is no scroller down. And the first topic dosnt have bullet.
Title: Re: [BLOCK] Unanswered Topics Block
Post by: JPDeni on November 26, 2008, 04:29:49 PM
It's because there's a missing quotation mark. Let's try it again.


global $db_prefix, $scripturl, $user_info, $modSettings;

$number_to_display = 4; // Change this if you want a different number to display. Use 0 to list all of them.
$most_recent_first = 0; // If you want to display the oldest first, change this to 0

if(!empty($modSettings['recycle_enable'])) $recycle_board = $modSettings['recycle_board'];
else $recycle_board = 0;

//////////////////////////////////////////

($most_recent_first == 1) ? $order = 'DESC' : $order = 'ASC';
($number_to_display == 1) ? $limit = '' : $limit = "LIMIT " . $number_to_display;

$query = db_query(
"SELECT m.subject, t.ID_TOPIC
FROM {$db_prefix}topics as t, {$db_prefix}messages as m, {$db_prefix}boards AS b
WHERE t.numReplies = 0
AND t.ID_FIRST_MSG = m.ID_MSG
AND t.ID_BOARD = b.ID_BOARD
AND $user_info[query_see_board]
AND b.ID_BOARD != $recycle_board
AND m.subject NOT LIKE '%MOVED:%'
ORDER BY RAND() " .
$limit, __FILE__, __LINE__);

echo  '<div style="width: 100%; height: 23ex;overflow: auto">';

while ($row = mysql_fetch_assoc($query))
  echo '<img src="http://tbn0.google.com/images?q=tbn:pQBIIcIWd2dZQM:http://i.pbase.com/u16/sutha/upload/5123820.bullet.jpg" />
        <a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '">' . $row['subject'] . '</a><br>';

echo '</div>';
Title: Re: [BLOCK] Unanswered Topics Block
Post by: alhaudhie on November 26, 2008, 04:31:39 PM
Yes... soo very nice work... tq.
Title: Re: [BLOCK] Unanswered Topics Block
Post by: FERNSIDEâ„¢ on November 30, 2008, 01:03:28 AM
Very nice.

Where would I look to make this show as a page, like the read/unread pages, and can this be set for a particular board?
eg..   questions/help board

Thank You :)
Title: Re: [BLOCK] Unanswered Topics Block
Post by: JPDeni on November 30, 2008, 03:00:34 AM
Quote
Where would I look to make this show as a page, like the read/unread pages

I don't know what that means.

Quote
can this be set for a particular board?

Possibly. Are you saying that you want it to be the unanswered posts started by one particular person and only on a particular board? If so, that would mean just adding another line to the WHERE clause. If you're asking for something else, it would probably require a completely different modification which ought to have its own topic.
Title: Re: [BLOCK] Unanswered Topics Block
Post by: FERNSIDEâ„¢ on November 30, 2008, 03:06:57 AM
See how when you click on Show replies or Show unread in the "user" block to the left, and it shows the requested on its own page, thats what I meant for your first question.

For your second, I was meaning to only grab the unanswered topics from one category/board.

eg. "support" board.

SMF 1.1.7
TP. 0.9.8
Title: Re: [BLOCK] Unanswered Topics Block
Post by: JPDeni on November 30, 2008, 03:11:32 AM
QuoteSee how when you click on Show replies or Show unread in the "user" block to the left, and it shows the requested on its own page, thats what I meant for your first question.

That would be an SMF mod and not a TP one.

QuoteFor your second, I was meaning to only grab the unanswered topics from one category/board.

The unanswered questions that were started by anyone?

ETA
I'm sorry. I was thinking this was another mod I just wrote. Blame it on too much turkey (we did T-Day a little late). I'll look at the code and see where it would be altered to do what you want.
Title: Re: [BLOCK] Unanswered Topics Block
Post by: JPDeni on November 30, 2008, 03:15:57 AM
Change


AND b.ID_BOARD != $recycle_board


tp


AND b.ID_BOARD = [the number of the board you want to get the messages from]


Title: Re: [BLOCK] Unanswered Topics Block
Post by: mcardo99 on December 17, 2008, 10:57:02 PM
Great work guys and girls =)
Title: Re: [BLOCK] Unanswered Topics Block
Post by: MrCare on October 12, 2010, 05:27:00 PM
any update for latest smf and latest TP versions?
Title: Re: [BLOCK] Unanswered Topics Block
Post by: ZarPrime on October 13, 2010, 01:48:16 PM
Hello QUBBAH,

No, this has not been updated for the latest versions of SMF and TinyPortal.  there are many block code snippets in this board that were written for earlier versions that will just simply not work anymore with the newest versions.  Is this something that you need?  If so, then perhaps one of our coders will update it for you at their earliest convenience.  Please be patient.

ZarPrime