Join two files like href and img src in HTML by means of Wiki markup?

Jump to: navigation, search

Hi!

I have an untypical question. It is possible to join two files (Media: and File:) in one link in the Wiki markup language?

For example:

[[Media:Python_Programming.pdf|[[File:Farm-Fresh_file_extension_pdf.png]]Python Programming]]
↑                                                                                           ↑
|--------------------------- one link to the pdf file with pdf icon ------------------------|

Of course, the above example does not work, but the same code as above in HTML language would look like this:

<a href="http://upload.wikimedia.org/wikipedia/commons/9/91/Python_Programming.pdf">
<img src="http://upload.wikimedia.org/wikipedia/commons/8/84/Farm-Fresh_file_extension_pdf.png" />Python Programming</a>

So far I have managed to do something like that code:

[[File:Farm-Fresh_file_extension_pdf.png|link={{filepath:Python_Programming.pdf}}]][[Media:Python_Programming.pdf|Python Programming]]

Which gives the following effect:

Farm-Fresh file extension pdf.pngPython Programming

But unfortunately this is not a single link as the whole. (The PDF icon is one link and text is another link to the same location)

I will be grateful for some help or any hits.

Best regards,
--
Danny

Danny37319:36, 22 September 2011

I don't think it gets better than what you're suggesting in the end. Two links with {{filepath:}} to generate an external link and feed it to the |link= parameter of the first link.

If you need this in many places you could create a template:

Template:PdfLink:

[[File:Farm-Fresh_file_extension_pdf.png|link={{filepath:{{{1|Example.png}}}}}]][[Media:{{{1|Example.png}}}|{{{2|{{{1|Example.png}}}}}}]]

And use {{PdfLink|Python_Programming.pdf|Python Programming}} to create:


Farm-Fresh file extension pdf.pngPython Programming

Krinkle02:23, 23 September 2011

Krinkle, thank you for your help. Admittedly it isn't exactly what I expected, namely one link like in HTML:

<a href="http://upload.wikimedia.org/wikipedia/commons/9/91/Python_Programming.pdf">
<img src="http://upload.wikimedia.org/wikipedia/commons/8/84/Farm-Fresh_file_extension_pdf.png" />Python Programming</a>


But your solution is also cool. I've created a "PDFLink" template according to your idea, and it works great. Thanks!

Danny37309:13, 25 September 2011
 

If you want all pdf links on an entire wiki to have this icon, then you shouldn't put the icon in the wikitext. Instead use CSS in MediaWiki:Common.css of your wiki. That way you only have to do this:

*{{filepath:Python_Programming.pdf}}
*[{{filepath:Python_Programming.pdf}} Python Programming]

and get this:

  • //upload.wikimedia.org/wikipedia/commons/9/91/Python_Programming.pdf
  • Python Programming ← icon
Krinkle02:29, 23 September 2011
 
Personal tools

Variants
Actions
Navigation
Support
Download
Development
Communication
Toolbox