News:

Support for jDownloads 3 has been ended
Since 17 August 2023 Joomla.org has discontinued support for Joomla 3.x. Therefore, we will no longer offer official support for our Joomla 3 jDownloads version 3.9.x from January 2024.
Please update your website to the latest Joomla version (Joomla 4 or Joomla 5) as soon as possible. Afterwards, please update jDownloads to the latest published version. The longer you delay, the more difficult the upgrade process for your website is likely to be.

Main Menu
Support-Forum

Edit download button style

Started by pastoweb, 18.06.2019 21:38:54

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

pastoweb


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</a></div>

Can I override it with my template?
  •  

ColinM

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
Colin M
  •  

pastoweb

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
  •  

ColinM

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</a></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

$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
$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
Colin M
  •  

pastoweb

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?
  •  

ColinM

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
Colin M
  •  

pastoweb

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</a> </div>

Any suggestion?
  •  

pastoweb

Ok found it, it was under:
/plugins/content/jdownloads/jdownloads.php

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

ColinM

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
Colin M
  •