Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change "Download" name with real name. #17

Open
megarlusci opened this issue Aug 23, 2022 · 6 comments
Open

Change "Download" name with real name. #17

megarlusci opened this issue Aug 23, 2022 · 6 comments
Labels
question Further information is requested

Comments

@megarlusci
Copy link

Screenshot_20220823-181656
Hello, I have a question
Can I open pdf with "pdf.js" if I click on "testfile 1" link or
Can I change name "Download" with real download name "testfile 1" ?
Thanks.

@Tazzios
Copy link
Owner

Tazzios commented Aug 23, 2022

see 'linktext' in the documentation

use code below if you want to show the filename in the jdownloads layout
linktext=""{file_name}"

Though be aware, there is a bug in jdownloads 3.9.8.3.4 with the {file_name} in some layouts.
https://www.jdownloads.com/forum/index.php?topic=13672.0

@megarlusci
Copy link
Author

megarlusci commented Aug 24, 2022

Thanks, I want to show the file name title ( testfile1 ), but it seems there is a problem with the jdownloads placeholder {file_title}. It doesn't work properly.

@Tazzios
Copy link
Owner

Tazzios commented Aug 27, 2022

That is because the placeholder contains not only the title but also htmlcode for the edit button behind it.
If i could escape all the html there still would be the problem that the edit icon gets 2 href actions, open pdf and edit page.

Best solution would be if jdownloads gets an extra placeholder which only contains the file title text.

update: looked at the code.
in #6 i added code to remove htmlcode directly. So in my code i do not use it so it has something to do how jdownloads and/or joomla handles placeholders in placeholders. Adjusting the content plugin order makes no different.

I created a topic at jdownloads.
https://www.jdownloads.com/forum/index.php?topic=13702.0

@Tazzios
Copy link
Owner

Tazzios commented Aug 28, 2022

I posted a solution in the jdownloads. Here is the solution if you want to try it your self:

create a placeholder: {file_title_only}

/components/com_jdownloads/views/category/tmpl/default.php
newline 1505:
$html_file = str_replace('{file_title_only}',$files[$i]->title, $html_file);

/components/com_jdownloads/views/downloadS/tmpl/default.php
newline 1130:
$html_file = str_replace('{file_title_only}',$items[$i]->title, $html_file);

/components/com_jdownloads/views/download/tmpl/default.php
newline 448:
$body = str_replace('{file_title_only}', $item->title, $body);

@megarlusci
Copy link
Author

Тhanks Tazzios, I made the changes and everything works fine.

I have one more question, Can I change link settings in Jdownloads Latest modul - joomla/modules/mod_jdownloads_latest/tmpl/default.php to use your plugin link for direct download ( line:75 )

@Tazzios
Copy link
Owner

Tazzios commented Aug 29, 2022

to prevent overriding the changes you might want to look at joomla overrides

For the module you can copy and rename the file to prevent overwriting with an update( or also use the joomla override location).
In the module>config you can select the new created layout 'Alternative Layout'
I would edit line 150 and 155 to:
$link_text = '{pdfviewer jdownloadsid='.$Itemid.' linktext="'.$files[$i]->title.'" }'

Not sure if this will work can`t test it at the moment. I think there is also need for content.prepare somewhere replace the placeholder.

@Tazzios Tazzios added the question Further information is requested label Apr 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants