Keyword

[SOLVED] Open attachments directly

More
8 years 11 months ago - 8 years 2 months ago #143241 by Web75
[SOLVED] Open attachments directly was created by Web75
Hi,
I'd like to open attachments directly, many are PDF, instead of having to choose whether to save or open the file. Using K2 2.6.8v and a few months ago I found the solution, but with some updating now I do not work anymore and I do not remember which file and how do I do.

Thanks in advance!
Last edit: 8 years 2 months ago by Web75.

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 11 months ago #143257 by Krikor Boghossian
Replied by Krikor Boghossian on topic Open attachments directly
Did you edit any core files?

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

More
8 years 11 months ago #143258 by Web75
Replied by Web75 on topic Open attachments directly
Hi Krikor,
yes.

Thanks

Please Log in or Create an account to join the conversation.

More
8 years 2 months ago #150797 by Web75
Replied by Web75 on topic Open attachments directly
[SOLVED]

File item.php

Inside the file I looked for this string:

<a title="<?php echo htmlentities($attachment->titleAttribute, ENT_QUOTES, 'UTF-8'); ?>" href="<?php echo JRoute::_('index.php?option=com_k2&view=item&task=download&id='.$attachment->id); ?>"> <?php echo $attachment->title ; ?>

You'll find that almost at the end of the second third of the file. And I changed it to:

<a title="<?php echo htmlentities($attachment->titleAttribute, ENT_QUOTES, 'UTF-8'); ?>" href="<?php echo JRoute::_('media/k2/attachments/'.$attachment->filename); ?>" TARGET="_blank"> <?php echo $attachment->title ; ?>

I'm using K2's default folder for attachments, but if you changed the folder, you must change the path to point to that particular folder.

www.joomlaworks.net/forum/k2-en/27294-solved-how-to-always-open-the-attached-pdf-files-directly-in-the-browser?limitstart=0

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum