You can use the CSS like they do (I know you said you would like to do this in a different way).
Code: Select all
.content a[href$=".pdf"].postlink,
.content a[href$=".PDF"].postlink {
background: url("https://upload.wikimedia.org/wikipedia/commons/4/4d/Icon_pdf_file.png") center right no-repeat; padding-right: 18px;
}
I guess this could be used in a loop and generate the icons for each extension in the overall_header_stylesheets_after EVENT without too much hassle.
I am not sure if <style> tag is allowed for custom CSS in an extension tho.
At the end you should end up with something like:
Code: Select all
<style>
{% set EXTENSIONS_LIST = [
{ ext: '.pdf', img_link: 'https://upload.wikimedia.org/wikipedia/commons/4/4d/Icon_pdf_file.png' },
{ ext: '.docx', img_link: 'path/to/docx-icon.png' },
{ ext: '.png', img_link: 'path/to/png-icon.png' }
] %}
{% for extension in EXTENSIONS_LIST %}
.content a[href$="{{ extension.ext }}"].postlink,
.content a[href$="{{ extension.ext|upper }}"].postlink {
background: url("{{ extension.img_link }}") center right no-repeat; padding-right: 18px;
}
{% endfor %}
</style>
Assuming the EXTENSION_LIST is queried from your list you define in the ACP.