简体   繁体   中英

Link Article title to a PDF file in joomla

I am using joomla 1.5 and looking out for Article Title is linkable and link goes to a pdf file. I am able to make Article Title Linkable but doesn't able to link it to a pdf file.

Is there any way to customise PDF Icon link?

Is there any way to do it? Any help appriciated.

You're probably aware that Joomla 1.5 is "End-of-Life" and no longer being maintained and presents a security issue and really should be upgraded to at least the Long Term Support 2.5 line if not the current Short Term Support 3.1 release.

In fact 1.5 is now at the point where extensions are no longer listed in the Joomla Extension Directory for it, and new 1.5 extensions are not being accepted.

You'll need to look in the PDF & Print section of the Archived Extensions Directory

Your question implies that using the standard PDF button in Joomla 1.5 isn't suitable for you either. (Don't forget that there are issues with the built-in PDF functions on older browsers.)

If you can't find a suitable extension then you will need to create a output override in your template directory for each of the content views that you want to modify. It's a trivial exercise to change the title in the article default tmpl file (ie com_content/views/article/tmpl/default.php ) so that it's wrapped in a URL that points to the PDF version of the view.

The PDF link is simply the same as the article link except it uses the PDF format, eg index.php?view=article&catid=1&id=45&format=pdf

So, if you're overriding the default output (ie the template you're using doesn't already have an override) you'll want the line where the page title is echo'd to change from:

<a href="<?php echo $this->article->readmore_link; ?>" class="contentpagetitle<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">
<?php echo $this->escape($this->article->title); ?></a>

to:

<a href="<?php echo JRoute::_('index.php?view=article&catid=' . $this->article->catid . '&id=' . $this->article->id . '&format=pdf'); ?>" class="contentpagetitle<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">
<?php echo $this->escape($this->article->title); ?></a>

It's worth considering that this means every article title will generate a PDF, this may confuse users. The link as it stands will also cause your websites page to be replaced with the PDF, you may want to add a target="_blank" to it so a new window/tab with the PDF is created.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM