[DEV] Topic icon on index

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment!
Scam Warning
NguyTieuNhan
Registered User
Posts: 96
Joined: Fri Nov 21, 2008 12:31 am

[DEV] Topic icon on index

Post by NguyTieuNhan »

Modification Name: Topic icon on index.
Author: NguyTieuNhan
Modification Description: Display last topic and topic icon of forum on index.
Modification Version: 1.0
Demo URL: * removed *
Image

Demo Username: Testhagiangpro
Demo Password: 123456
Download: Here
MOD history:
11-01-2012: Fix can not get topic_id.

Download and test if you have error, pls Report to me.
Last edited by marian0810 on Fri Jan 13, 2012 6:40 pm, edited 6 times in total.
Reason: link to warez site removed
User avatar
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am

Re: [DEV] Topic icon on index

Post by 4_seven »

If i click on

Teen News » Board index » KHÔNG GIAN IT - WEBMASTER

Code: Select all

General Error
Language file ./language/en/mods/tpotm.php couldn't be opened.
Current Mods | Mod Base | php(BB) programming | No help via PM
Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 27157
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

Re: [DEV] Topic icon on index

Post by Paul »

Hello,

Per Modification Development rules (rule 5c specifically in this case) you must provide an unfettered link that does not require any sort of registration.

Thank you,
The phpBB Modifications Team
NguyTieuNhan
Registered User
Posts: 96
Joined: Fri Nov 21, 2008 12:31 am

Re: [DEV] Topic icon on index

Post by NguyTieuNhan »

4_seven wrote:If i click on

Teen News » Board index » KHÔNG GIAN IT - WEBMASTER

Code: Select all

General Error
Language file ./language/en/mods/tpotm.php couldn't be opened.
Thanks.
Paul wrote:Hello,

Per Modification Development rules (rule 5c specifically in this case) you must provide an unfettered link that does not require any sort of registration.

Thank you,
The phpBB Modifications Team
Thank you.
User avatar
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am

Re: [DEV] Topic icon on index

Post by 4_seven »

A good mod, thx for sharing :D
Current Mods | Mod Base | php(BB) programming | No help via PM
koziolek
Registered User
Posts: 5
Joined: Tue Oct 04, 2011 11:28 am

Re: [DEV] Topic icon on index

Post by koziolek »

Hi
After installing this MOd on the main forum occurred error ;/

Code: Select all

SQL ERROR [ mysql4 ]

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 '' at line 3 [1064]

SQL

SELECT icon_id, icons_url FROM phpbb_posts AS p LEFT JOIN phpbb_icons AS i ON (i.icons_id = p.icon_id) WHERE forum_id = 2 AND topic_id=

BACKTRACE

FILE: includes/db/mysql.php
LINE: 175
CALL: dbal->sql_error()

FILE: includes/functions_display.php
LINE: 411
CALL: dbal_mysql->sql_query()

FILE: index.php
LINE: 28
CALL: display_forums()
Please help, thanks :)
User avatar
Meis2M
Translator
Posts: 943
Joined: Wed Mar 03, 2010 11:32 am
Location: IR.Damghan
Name: میثم نوبری
Contact:

Re: [DEV] Topic icon on index

Post by Meis2M »

Hi

i cant download this MOD.

the link is Dead? :(
phpBB persian international support
Follow us in Instagram
Free upgrade and install extensions on your forum - drop me PM
Ultimate phpBB SEO Friendly URL extension
koziolek
Registered User
Posts: 5
Joined: Tue Oct 04, 2011 11:28 am

Re: [DEV] Topic icon on index

Post by koziolek »

User avatar
Meis2M
Translator
Posts: 943
Joined: Wed Mar 03, 2010 11:32 am
Location: IR.Damghan
Name: میثم نوبری
Contact:

Re: [DEV] Topic icon on index

Post by Meis2M »

koziolek wrote:Hi
After installing this MOd on the main forum occurred error ;/

Code: Select all

SQL ERROR [ mysql4 ]

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 '' at line 3 [1064]

SQL

SELECT icon_id, icons_url FROM phpbb_posts AS p LEFT JOIN phpbb_icons AS i ON (i.icons_id = p.icon_id) WHERE forum_id = 2 AND topic_id=

BACKTRACE

FILE: includes/db/mysql.php
LINE: 175
CALL: dbal->sql_error()

FILE: includes/functions_display.php
LINE: 411
CALL: dbal_mysql->sql_query()

FILE: index.php
LINE: 28
CALL: display_forums()
Please help, thanks :)

how can fix this problem?
phpBB persian international support
Follow us in Instagram
Free upgrade and install extensions on your forum - drop me PM
Ultimate phpBB SEO Friendly URL extension
User avatar
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am

Re: [DEV] Topic icon on index

Post by 4_seven »

change edit

in includes/functions_display.php

from

Code: Select all

//        // Begin Topic Icon on Index - http://hagiangpro.com
            $sql_icon = 'SELECT icon_id, icons_url FROM '.POSTS_TABLE.' AS p
               LEFT JOIN '.ICONS_TABLE.' AS i ON (i.icons_id = p.icon_id)
               WHERE forum_id = '.$row['forum_id_last_post'].' AND topic_id='.$row['topic_id'];       
            $result = $db->sql_query($sql_icon);
            $row_icon = $db->sql_fetchrow($result);
            if ($row_icon['icon_id']){
            $icon_img = "<img src=images/icons/" . $row_icon['icons_url'] ." >";
            }else{ 
            $icon_img = "<img src=images/icons/hagiangpro.com.gif >";
            }        
        // End Topic Icon on Index - http://hagiangpro.com 
to

Code: Select all

        // Begin Topic Icon on Index - http://hagiangpro.com
            $sql_icon = 'SELECT icon_id, icons_url FROM ' . POSTS_TABLE . ' AS p
               LEFT JOIN ' . ICONS_TABLE . ' AS i ON (i.icons_id = p.icon_id)
               WHERE forum_id = ' . $row['forum_id_last_post'] . ' 
               AND topic_id = ' . $row['topic_id'];       
            $result = $db->sql_query($sql_icon);
            $row_icon = $db->sql_fetchrow($result);
            if ($row_icon['icon_id']){
            $icon_img = "<img src=images/icons/" . $row_icon['icons_url'] ." >";
            }else{ 
            $icon_img = "<img src=images/icons/hagiangpro.com.gif >";
            }        
        // End Topic Icon on Index - http://hagiangpro.com 
Current Mods | Mod Base | php(BB) programming | No help via PM
User avatar
Meis2M
Translator
Posts: 943
Joined: Wed Mar 03, 2010 11:32 am
Location: IR.Damghan
Name: میثم نوبری
Contact:

Re: [DEV] Topic icon on index

Post by Meis2M »

ohhhhhhhh

not work yet.

another error

Code: Select all

SQL ERROR [ mysql4 ]

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 '' at line 4 [1064]

SQL

SELECT icon_id, icons_url FROM phpbb_posts AS p LEFT JOIN phpbb_icons AS i ON (i.icons_id = p.icon_id) WHERE forum_id = 502 AND topic_id =

BACKTRACE

FILE: includes/db/mysql.php
LINE: 175
CALL: dbal->sql_error()

FILE: includes/functions_display.php
LINE: 464
CALL: dbal_mysql->sql_query()

FILE: viewforum.php
LINE: 185
CALL: display_forums()
phpBB persian international support
Follow us in Instagram
Free upgrade and install extensions on your forum - drop me PM
Ultimate phpBB SEO Friendly URL extension
User avatar
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am

Re: [DEV] Topic icon on index

Post by 4_seven »

than try

Code: Select all

        // Begin Topic Icon on Index - http://hagiangpro.com
        $row_forum_id_last_post = $row['forum_id_last_post'];
        $row_topic_id = $row['topic_id'];

            $sql_icon = 'SELECT icon_id, icons_url FROM ' . POSTS_TABLE . ' AS p
               LEFT JOIN ' . ICONS_TABLE . " AS i ON (i.icons_id = p.icon_id)
               WHERE forum_id = $row_forum_id_last_post 
               AND topic_id = $row_topic_id";       
            $result = $db->sql_query($sql_icon);
            $row_icon = $db->sql_fetchrow($result);
            if ($row_icon['icon_id']){
            $icon_img = "<img src=images/icons/" . $row_icon['icons_url'] ." >";
            }else{ 
            $icon_img = "<img src=images/icons/hagiangpro.com.gif >";
            }        
        // End Topic Icon on Index - http://hagiangpro.com    
or

Code: Select all

        // Begin Topic Icon on Index - http://hagiangpro.com
        $row_forum_id_last_post = $row['forum_id_last_post'];
        $row_topic_id = $row['topic_id'];

            $sql_icon = 'SELECT icon_id, icons_url FROM ' . POSTS_TABLE . ' AS p
               LEFT JOIN ' . ICONS_TABLE . " AS i ON (i.icons_id = p.icon_id)
               WHERE forum_id == $row_forum_id_last_post 
               AND topic_id == $row_topic_id";       
            $result = $db->sql_query($sql_icon);
            $row_icon = $db->sql_fetchrow($result);
            if ($row_icon['icon_id']){
            $icon_img = "<img src=images/icons/" . $row_icon['icons_url'] ." >";
            }else{ 
            $icon_img = "<img src=images/icons/hagiangpro.com.gif >";
            }        
        // End Topic Icon on Index - http://hagiangpro.com    
Current Mods | Mod Base | php(BB) programming | No help via PM
User avatar
Meis2M
Translator
Posts: 943
Joined: Wed Mar 03, 2010 11:32 am
Location: IR.Damghan
Name: میثم نوبری
Contact:

Re: [DEV] Topic icon on index

Post by Meis2M »

ohhhhhhh


error and error again... not working both...

Code: Select all

QL ERROR [ mysql4 ]

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 '== 2 AND topic_id == 120' at line 3 [1064]

SQL

SELECT icon_id, icons_url FROM phpbb_posts AS p LEFT JOIN phpbb_icons AS i ON (i.icons_id = p.icon_id) WHERE forum_id == 2 AND topic_id == 120

BACKTRACE

FILE: includes/db/mysql.php
LINE: 175
CALL: dbal->sql_error()

FILE: includes/functions_display.php
LINE: 467
CALL: dbal_mysql->sql_query()

FILE: index.php
LINE: 54
CALL: display_forums()
phpBB persian international support
Follow us in Instagram
Free upgrade and install extensions on your forum - drop me PM
Ultimate phpBB SEO Friendly URL extension
User avatar
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am

Re: [DEV] Topic icon on index

Post by 4_seven »

your ohhhh is annoying. it seems, that this code is syntactical crap.
also you don't have post the complete error message (topic_id < no index), which is important.
have checked it very quick. $row['topic_id'] is not present at this part,
so it can not work. don't know how old this is, but it must be reworked.
Current Mods | Mod Base | php(BB) programming | No help via PM
User avatar
canonknipser
Registered User
Posts: 2096
Joined: Thu Sep 08, 2011 4:16 am
Location: Germany
Name: Frank Jakobs
Contact:

Re: [DEV] Topic icon on index

Post by canonknipser »

the double equals are wrong in a SQL-Query forum_id == 2 AND topic_id == 120

Its OK for php-statements as it means "equal to" there, but in SQL-statements you have to use single equals:
forum_id = 2 AND topic_id = 120,
which in php-syntax means "assign right value to left"

It can be really confusing to have a mix of different languages in one script ;)
Greetings, Frank
phpbb.de support team member
English is not my native language - no support via PM or mail
New arrival - Extensions and scripts for phpBB
Locked

Return to “[3.0.x] MODs in Development”