News:

Wondering if this will always be free?  See why free is better.

Main Menu

Sort Attachments in Topic

Started by tatoline, December 19, 2014, 02:40:24 PM

Previous topic - Next topic

tatoline

Hello,

Do you know how to sort attachments in one topic?

Thank you.

Kindred

you are going to have to be more specific...

What do you mean by "sort attachments"?
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

tatoline

Quote from: Kindred on December 19, 2014, 02:53:58 PM
you are going to have to be more specific...

What do you mean by "sort attachments"?

Look my attachments, they are not sorted, how to sort alphabetically for all attachments in all topics?
I mean:
a.png
b.png
c.png
d.png
e.png
f.png etc.

Kindred

upload them in the order you want them displayed?

there is no way to force a sort by default -- and I don't think a mod has been made to do it.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

tatoline

Quote from: Kindred on December 19, 2014, 03:51:51 PM
upload them in the order you want them displayed?

there is no way to force a sort by default -- and I don't think a mod has been made to do it.

Yea I upload them in the order I want them displayed but I edit the topic from time to time and add new attachments, so it be not sorted. Every time I edit the topic and the it's attachments, I have to delete all attachments and upload again for sorted attachments.

So you say the attachments can't be sorted after first upload and there is no mod for this and can't do it with any mod, right? :/

Kindred

Well, you could do it with a mod...  But there is not mod, currently existing, which does it...
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Sir Osis of Liver

#6
Here ya go, mope -

Display.template.php



// Assuming there are attachments...
if (!empty($message['attachment']))
{
echo '
<div id="msg_', $message['id'], '_footer" class="attachments smalltext">
<div style="overflow: ', $context['browser']['is_firefox'] ? 'visible' : 'auto', ';">';

$last_approved_state = 1;


/// Sort attachments alphabetically
foreach ($message['attachment'] as $key => $row)
{
    $name[$key] = $row['name'];
}
array_multisort($name, SORT_ASC, $message['attachment']);


foreach ($message['attachment'] as $attachment)


Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

tatoline

Quote from: Krash on December 19, 2014, 10:42:43 PM
Here ya go, mope -

Display.template.php



// Assuming there are attachments...
if (!empty($message['attachment']))
{
echo '
<div id="msg_', $message['id'], '_footer" class="attachments smalltext">
<div style="overflow: ', $context['browser']['is_firefox'] ? 'visible' : 'auto', ';">';

$last_approved_state = 1;


/// Sort attachments alphabetically
foreach ($message['attachment'] as $key => $row)
{
    $name[$key] = $row['name'];
}
array_multisort($name, SORT_ASC, $message['attachment']);


foreach ($message['attachment'] as $attachment)



Thank you very much! You really helped me dude :)

Spikey_IT

I just found that code to sort the attachments by Sir Osis of Liver. Do I have to link this php file in another php file? Just creating this file and upload it doesn't work for me.
I run SMF 2.0.15

Kindred

Quote from: Sir Osis of Liver on December 19, 2014, 10:42:43 PM
Here ya go, mope -

Display.template.php



// Assuming there are attachments...
if (!empty($message['attachment']))
{
echo '
<div id="msg_', $message['id'], '_footer" class="attachments smalltext">
<div style="overflow: ', $context['browser']['is_firefox'] ? 'visible' : 'auto', ';">';

$last_approved_state = 1;


/// Sort attachments alphabetically
foreach ($message['attachment'] as $key => $row)
{
    $name[$key] = $row['name'];
}
array_multisort($name, SORT_ASC, $message['attachment']);


foreach ($message['attachment'] as $attachment)




as he said... in Display.template.php

and it's not just a paste...  you have to find and replace code with the new code
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Advertisement: