jDownloadsownloads.com


Author Topic: Edit download button style  (Read 267 times)

0 Members and 1 Guest are viewing this topic.

Offline pastoweb

  • Newbie
  • *
  • Posts: 9
Edit download button style
« on: 18.06.2019 21:38:54 »

Where can I edit the code  for the download button?

<div class="jd_title_right  jd_download_url_position" style=""><a href="" class="jdbutton jorange ">Download[/url]</div>

Can I override it with my template?

Offline ColinM

  • Moderator
  • *
  • Posts: 3.975
Re: Edit download button style
« Reply #1 on: 18.06.2019 22:12:58 »
HiThe buttons are entirely cenerated by css.
If you go to Layouts and select css you can see what styling is used in the front end and also what is used for styling the button.  Any overriding css can be put in jdownloads_custom.css.  All the css used by jD includes the prefix jd_ to minimise clashes.  As the custom css is loaded last it overrides any other css except for the direct styling in the layouts, but the layouts can be modified anyway.  There is some documentation in
http://www.jdownloads.net/documentations/category/layouts
Colin

Offline pastoweb

  • Newbie
  • *
  • Posts: 9
Re: Edit download button style
« Reply #2 on: 18.06.2019 22:40:03 »
Thanks, but I'd like to add my own classes to automatically get the same styles of my template, instead of duplicate them

Where is that code located? I couldn't find it under /components/com_jdownloads/views/download/tmpl/default.php

Offline ColinM

  • Moderator
  • *
  • Posts: 3.975
Re: Edit download button style
« Reply #3 on: 19.06.2019 15:34:05 »
Hi
This is not as straight forward as you may think as jD has many possibilities.Here I suppose you are trying to modify the Download button that appears in the list of Downloads.You could of course opt to have no button and to use the title as a link which avoids the problem.
There is not just one item of code concered as you could be showing a list of Downloads or you could be showing the Download Details view
In the Downloads list the generated code is like
<div class="jd_download_url jd_download_url_position" style="">        <a target="_blank" href="link details" title="Download" class="jdbutton jorange jsmall">Download[/url]</div>
This code is generated from two sources.  One of these is the active Downloads layout and the other is file
\components\com_jdownloads\views\downloads\tmpl\default.php
The layout part is straight forward. In the files layout there will be a line like
     <div class="jd_download_url jd_download_url_position" style="">{url_download}</div>
You could change those but they are only concerned with the actual link and the positioon of the link.
The button styling css is the part class="jdbutton jorange jsmall".This is generated at around line 966 which is

Code: [Select]
$download_link_text = '<a '.$blank_window.' href="'.$download_link.'" title="'.JText::_('COM_JDOWNLOADS_LINKTEXT_DOWNLOAD_URL').'" class="jdbutton '.$download_color.' '.$download_size_listings.'">';so that could be overriden by an default.php file that contained
Code: [Select]
$download_link_text = '<a '.$blank_window.' href="'.$download_link.'" title="'.JText::_('COM_JDOWNLOADS_LINKTEXT_DOWNLOAD_URL').'" class="your_css_class">';There is a similar section in the Downloads details file
\components\com_jdownloads\views\download\tmpl\default.php at around line 692
In both php files there is a reference to 'old button style'.  This is no longer used and will not be supported in the next major release.
Hope this helps - but much easier to repeat the css.  Note we are currently working on a new major release of jD where the php files may be different but the classes used for the buttons will remain

ColinPS I forgot about the Summary view\components\com_jdownloads\views\summary\tmpl\default.php at around line 640

Offline pastoweb

  • Newbie
  • *
  • Posts: 9
Re: Edit download button style
« Reply #4 on: 24.06.2019 21:54:16 »
Thanks, I found the code and put a default.php under [template]/html/com_jdownloads/download

But it's not overriding... I want to style a direct download link, maybe the code is in a different position?

Offline ColinM

  • Moderator
  • *
  • Posts: 3.975
Re: Edit download button style
« Reply #5 on: 25.06.2019 10:27:33 »
Hi
I am not familiar with Component overides and I think perhaps you may have put the default.php file in the wrong place. From what little I know I believe Component overrides are quite different from Jooma! core overrides.
Note that in common with Joomla! there are many default.php files used in jD, all from different directory locations.Really think for initial puposes you should try a css solution. Then you have something to check against.
Colin

Offline pastoweb

  • Newbie
  • *
  • Posts: 9
Re: Edit download button style
« Reply #6 on: 25.06.2019 14:20:45 »
Nope, it doesn't change even editing directly the core view files under /download and /downloads, it must be somewhere else
This is the code I'm getting in frontend, using a direct download link on file title:

<div class="jd_content jd_content_plugin jd_content_file"><a href=".." title="Download" class="jd_download_url">Forma LMS 2.2.1[/url] </div>

Any suggestion?

Offline pastoweb

  • Newbie
  • *
  • Posts: 9
Re: Edit download button style
« Reply #7 on: 25.06.2019 14:40:53 »
Ok found it, it was under:
/plugins/content/jdownloads/jdownloads.php

don't think this can be overridden, but ok for now

Offline ColinM

  • Moderator
  • *
  • Posts: 3.975
Re: Edit download button style
« Reply #8 on: 25.06.2019 15:22:54 »
Hi
Did not appreciate you are using the Content PluginThe Content plugin will be using a layout as set in Config - Plugins  You could create your own layout
Colin