Thread image on threads view
1master1 Offline
Member
***
Posts: 232
Joined: Oct 2010
Post: #1
Thread image on threads view
well, i had seen this with other forum softwares that allows you to display a image infront of the thread's name in threads display.

when we post an external image by [img] tags in the thread, it will be called automatically to the threads display section and it will be displayed infront of that thread name.

   
   
   

is it possible to make it?
10-21-2010 07:05 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #2
RE: Thread image on threads view
Not by [img] tags, but use something like the XThreads gallery example and modify templates to suit yourself.

My Blog
10-21-2010 08:21 AM
Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #3
RE: Thread image on threads view
I think so.
If it is image upload, I think it is not too difficult to do that with XThreads (using File field type).
Then, modify forumdisplay_thread and/or forumdisplay_threadlist template.

10-22-2010 06:59 AM
Find all posts by this user Quote this message in a reply
Imran Offline
Member
***
Posts: 204
Joined: Apr 2010
Post: #4
RE: Thread image on threads view
You can see this too: http://community.mybb.com/thread-47562-p...http://community.mybb.com/thread-47562-post-332031.html

[Image: logo.png]

[Image: twitter.png]
10-23-2010 02:34 AM
Visit this user's website Find all posts by this user Quote this message in a reply
1master1 Offline
Member
***
Posts: 232
Joined: Oct 2010
Post: #5
RE: Thread image on threads view
thank you very much imran Smile
10-23-2010 03:25 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #6
RE: Thread image on threads view
(10-23-2010 02:34 AM)Imran Wrote:  You can see this too: http://community.mybb.com/thread-47562-p...http://community.mybb.com/thread-47562-post-332031.html
In-loop query...  Yuck!

My Blog
10-23-2010 09:11 AM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #7
RE: Thread image on threads view
(10-23-2010 09:11 AM)ZiNgA BuRgA Wrote:  In-loop query...  Yuck!

Hi Zinga, what does that mean and why is it a bad thing? Does it affect the efficiency of the board/forum?


[Image: leelink.gif]
MYBB1.6 & XThreads
10-23-2010 09:24 AM
Visit this user's website Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #8
RE: Thread image on threads view
It's discouraged as it puts unnecessary additional load on the forum.
http://stackoverflow.com/questions/94621...http://stackoverflow.com/questions/946214/one-sql-query-or-many
http://expressionengine.com/user_guide/d...http://expressionengine.com/user_guide/development/guidelines/performance.html#redunda

Arguably, this may not be a big issue if you don't have a lot of threads, and have very few visitors to your website (coupled with the fact that many MySQL servers are installed locally on the webserver), however it can be considered bad coding practice (and a hallmark of the n00b script kiddie).
It IS more of a problem if you have a remote SQL server (larger sites, or some shared hosting providers do this) as queries are slower due to increased latency.  And if you're a high traffic forum, this can generate significantly more load on the webserver <-> DB server network.

Simple example of an in-loop query:

PHP Code:
for(...) {
  $stuff = $db->fetch_array($db->simple_select(..., 'id='.$id));
}

More appropriate way:

PHP Code:
1
2
3
4
5
6
7
$query = $db->simple_select(..., 'id IN ('.$ids.')');
$data = array();
while($thing = $db->fetch_array($query))
  $data[$thing['id']] = $thing;
for(...) {
  $stuff = $data[$id];
}


Top one is easier and quicker to write, which is why a lot of people do it, despite it being "bad".


My Blog
10-23-2010 11:21 AM
Find all posts by this user Quote this message in a reply
Imran Offline
Member
***
Posts: 204
Joined: Apr 2010
Post: #9
RE: Thread image on threads view
Thanks for the explanation Yumi Smile

[Image: logo.png]

[Image: twitter.png]
10-23-2010 08:41 PM
Visit this user's website Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #10
RE: Thread image on threads view
Thank you - it was interesting - I spent a while looking around stackoverflow. Some new things on there for me to learn.


[Image: leelink.gif]
MYBB1.6 & XThreads
10-24-2010 04:08 AM
Visit this user's website Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: