Firefox PHP

Attachments flag

Posted by bobdobbs 
Attachments flag
September 29, 2004 04:02PM
I don't see where I can indicate whether or not a post has attachments. Is this possible? If not; doe's anyone have any suggestions as to how this might be implemented?
Re: Attachments flag
September 29, 2004 05:37PM
Let me explain that a little better...
That is to say before you click on the individual post to read it.

Kind of like how on the forum index there is a "views" column where you can see how many time the post has been read. Is there a way to maybe have another column with the number of attachments?
Re: Attachments flag
September 29, 2004 08:52PM
To get a count, you will have to use some PHP.
<?php if(count($PHORUM["TMP"]["ROWS"]["meta"]["attachments"])){ ?>
Do Stuff
<?php } ?>

Brian - Cowboy Ninja Coder - Personal Blog - Twitter
Re: Attachments flag
October 15, 2004 07:57PM

Did you manage to get this going?
I would be interested in your solution..

Re: Attachments flag
November 20, 2004 03:14AM
From what I understand, the "Attachments" problem is one of the "mysql.php" and "list[_threads].tpl" files.

In the "list[_threads.tpl" template file, you have options on what to display (there's a couple {IF...} statements in there), one being the count.

Unfortunatly, in order to show whether attachments exist or not requires the mysql.php file to run a query that includes the information in the "meta" field of the "[phorumname]_messages" table.

Now, you 'could' run a query against the returned messageid to the "[phorumname]_files" table (a join, basically), but we're talking some work here.

OK, I could be totally full of it, in the wrong 100%, but noone has proven me wrong yet, so I'm gonna stick with these as my issues as to why attachment flags are a pain in the arse.

using the
{IF MESSAGE->attachments}
doesn't work. No-sir.
Re: Attachments flag
November 20, 2004 04:38AM
chadedge, no you are wrong, mysql.php doesn't have anything to do with it, no additional query needed.

What brian posted works just fine.
A simple:
<?php if(isset($PHORUM["TMP"]["ROWS"]["meta"]["attachments"]) && count($PHORUM["TMP"]["ROWS"]["meta"]["attachments"])){ ?>
<?php } ?>

shows you if a message has attachments.

Yeah, your other solution with template-tags doesn't work as these are only computed in read.php

Thomas Seifert

Edited 1 time(s). Last edit at 11/20/2004 04:39AM by ts77.
Re: Attachments flag
November 21, 2004 02:40AM
Fantastic, that makes a lot more sense.

Thanks for clearing up what had turned into a big mess.

Re: Attachments flag
November 21, 2004 01:56PM
In another forum (add-ons), see at the bottom :

The code don't work, for me ;)

Edit: removed session-id from link, you don't want others to be you, right? ;)

Edited 1 time(s). Last edit at 11/21/2004 02:01PM by ts77.
Re: Attachments flag
November 21, 2004 02:03PM
florent, the code works, but only for the current message. it doesn't tell if the thread contains any attachments at all, it tells if THIS MESSAGE has an attachment.

Thomas Seifert
Re: Attachments flag
November 22, 2004 06:14AM
Ok thanks, i did'nt understood.
Sorry, only registered users may post in this forum.

Click here to login