PDA


View Full Version : News Attachments


ConqSoft
09-13-2005, 01:30 PM
With vB 3.5, you can define per File Extension/Type if that type should be opened in a new window or not. I have all mine set to open in a new window, but when clicking an attachment displayed on the CMPS News module, it opens in the current window.

Brian
09-13-2005, 01:48 PM
If you'll look in your modules/news.php file for this code:
$getnattach = $db->query_read("SELECT attachmentid, filename, filesize, visible, postid, IF(thumbnail_filesize > 0, 1, 0) AS hasthumbnail, counter, thumbnail, LENGTH(thumbnail) AS thumbnailsize FROM " . TABLE_PREFIX . "attachment WHERE postid IN(" . implode(',', $newspids) . ") ORDER BY attachmentid");

Replace with this:
$getnattach = $db->query_read("
SELECT attachmentid, filename, filesize, visible, postid, IF(thumbnail_filesize > 0, 1, 0) AS hasthumbnail, counter, attachment.thumbnail, LENGTH(attachment.thumbnail) AS thumbnailsize, newwindow
FROM " . TABLE_PREFIX . "attachment AS attachment
LEFT JOIN " . TABLE_PREFIX . "attachmenttype AS attachmenttype USING (extension)
WHERE postid IN(" . implode(',', $newspids) . ")
ORDER BY attachmentid
");

Then find:
eval('$news[\'attachment\'] .= "' . fetch_template('postbit_attachmentthumbnail') . '";');

Add this right above:
$show['newwindow'] = $attachment['newwindow'];

And that should take care of the problem.

ConqSoft
09-13-2005, 01:59 PM
Yep, that did it. Thanks!

burley
04-11-2006, 12:52 PM
is it also possible to replace the link behind the attachment in total?

NemoTech
05-08-2006, 09:25 PM
Exactly what I was looking for... :)

NemoTech
05-08-2006, 09:28 PM
Can you customize how the new window will look... the size... add background color etc... a close button...

ConqSoft
05-08-2006, 10:51 PM
No. It just adds a target="_blank" to the link. It's a vBulletin feature, not a CMPS feature.