Fixing PDF button error with SEF in Joomla 1.5

Homepage > Home > Coding > Fixing PDF button error with SEF in Joomla 1.5

Fri 04/17/2009

in Coding, PHP

One of the weirdest error in Joomla 1.5 is that just turning SEF on makes PDF button stop working in content articles.
This happens with both system and 3rd party components.

I’ve recently digged the problem and found that this could be related (kinda randomly) to a bunch of problems and conflicts with other Joomla feature (such as system cache).

In my own projects im using right now SH404SEF as SEF component and i’ve found it’s a really good piece of software, so here is a recap of the fix/patch for the problem.

First of all upgrade SH404 to the latest release by downloading it from JoomlaCode.

Now open custom.sef.php in administrator/components/com_sh404sef/ and search for a line containing:

$shDefaultParams['sh404SEF_PROTECT_AGAINST_DOCUMENT_TYPE_ERROR'] = 0;

and set the paramenter to 1:

$shDefaultParams['sh404SEF_PROTECT_AGAINST_DOCUMENT_TYPE_ERROR'] = 1;

If this line is not present then add it at the end of the file.

Now go to the backend panel in Joomla and purge all SEF url by:
Components -> SH404SEF -> Purge SEF Urls
then clear the cache by:
Tools -> Clean Cache

This will clear all current URLs, so that SH404SEF has to recreate them, anyway your PDF button should work again and the PDF URLs should be as the HTML one with an ending parameter ?format=pdf.

Source: http://extensions.siliana.com/forums/index.php?topic=9509.0

Note: As a side effect you shouldn’t problably be able to use the pdf folder feature to store custom PDFs!

No Related Posts

Tags: , ,

4 Responses to this post:

  • tedd says:

    that was a great tip, almost :-)
    I tried it, and it brought up the page in a small window and called it a pdf, yet the contet (myblog) had a 404 page in it. I closed it and tried again, which brought back the 404 on the entire page again.
    Very frustrating all this.
    Thanks for trying

    • Dwight Jack says:

      Well, yeah. I’ve seen some other solutions to this issue, since there are lot of variables that could generate the error.
      You may also combine my code with this hack, even if it solves an issue where PDF icon opening a popup results in a blank page, not 404.

  • MBHO says:

    Thanks! This worked like a charm!

  • John says:

    Perfect! Thanks very much, works like a breeze!

Leave a Reply ()

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

* required.