Attachments in new window

Started by ekoo, January 21, 2011, 02:55:51 PM

Previous topic - Next topic

ekoo

Greetings.

I've got a forum with a constrained width.   Thus, when expanding image attachments, it cuts off the right side overflow.   To prevent this, I'd like to open attachments in a new window.    I tried editing the href hook in the Display.php, but it didn't take.

Any ideas on how to make attachments open in a new window vs. the same one you're in?

Thanks in advance.

Kindred

Quote from: ekoo on January 21, 2011, 02:55:51 PM
I tried editing the href hook in the Display.php, but it didn't take.


Please be more specific.   What do you mean "it didn't take"?

Did you also edit display.template.php?
Сл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."

ekoo

I mean, I edited the following area in Display.php: 

'href' => $scripturl . '?action=dlattach;topic=' . $topic . '.0;attach=' . $attachment['id_attach'],
'link' => '<a href="' . $scripturl . '?action=dlattach;topic=' . $topic . '.0;attach=' . $attachment['id_attach'] . '">' . htmlspecialchars($attachment['filename']) . '</a>',

I tried to add a target="_blank" to test out opening in a new window, but no luck.

I did not see anywhere in the display.template.php that had code that controlled the attachments in posts.

Kindred

you added the target to WHICH line?
Сл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."

ekoo

As follows:

'link' => '<a href="' . $scripturl . '?action=dlattach;topic=' . $topic . '.0;attach=' . $attachment['id_attach'] . '" target="_blank">' . htmlspecialchars($attachment['filename']) . '</a>',


Thanks.

Kindred

I don't have the code in front of me, but I suspect that display.template.php uses the href out of the array, not the link.
Сл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."

ekoo

Alright, I'll revisit display.template.php again and see if I can find where it's writing that.    Thanks.

Kays

In the Admin CP > Features and Options > Layout. You can specify the maximum size of posted images. If an attachment is lager than those dimensions, it should open it in a new window.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Road Rash Jr.

Highslide mod works for this without messing with the code
http://custom.simplemachines.org/mods/index.php?mod=2518
Or you could just set the attachment permissions to a smaller sized attachment so it fits the screen.
Never argue with an Idiot like myself, they just drag you down to their level then beat you with experience.

ekoo

Quote from: Kays on January 24, 2011, 01:25:23 PM
In the Admin CP > Features and Options > Layout. You can specify the maximum size of posted images. If an attachment is lager than those dimensions, it should open it in a new window.
THAT is what I was looking for!   Thanks so much. 

That mod looks nice too, I may try that out, thanks.

Advertisement: