Small Fixes for phpMyFAQ

phpMyFAQ is a nice idea, and mostly it’s well done, but with a few basic mistakes in how it’s been implemented that were so annoying I couldn’t live with them. There’s no Debian package for this app, sadly, so things like “using a better version of TinyMCE” require you to manually fix them all (no package-management based solution here, unless you want to maintain it yourself?).

For future reference (and for anyone else wanting to make their phpMyFAQ a bit more bearable), here’s the fixes I’ve applied:

  1. Disable/Remove/Delete/Destroy TinyMCE
    • WHY?
      1. Because the LATEST version of phpMyFAQ includes a very old and out of date and *completely broken* version of TinyMCE
      2. The version used crashes Safari every time you click with the mouse
      3. The version used slows a 2ghz CPU to a crawl under Firefox (this is why Safari crashes: it keeps killing the javascript engine for taking up too much CPU)
      4. The author of phpMyFAQ hard-coded TinyMCE as a required part of the app, so they don’t “allow” you to disable it
    • HOW?
      1. Edit the file which contains the editor (confusingly, this is: “admin/footer.php”) and just brutally delete the code that causes TinyMCE to be embedded in the page. The section about TinyMCE is contained inside these tags; delete everything inside them:

        <!– tinyMCE –>
        <!– /tinyMCE –>

    • PROBLEMS?
      1. The author of phpMyFAQ has apparently hard-coded some of the features of phpMyFAQ to be embedded *inside* a customised TinyMCE script. So, for instance, you lose the ability to refer to other FAQ’s from within a FAQ. This is a big loss. However … considering that on one browser (Safari) it is literally impossible to use the product at all if you have that version of TinyMCE running, and on the main browser I use (Firefox) you have to wait a second for each character you type to actually appear in the window (same bug), there is no other way to use phpMyFAQ if you do NOT somehow replace TinyMCE
      2. Suggestions: You could try upgrading manually to the current TinyMCE instead, or doing a lot more PHP editing to re-enable the “refer to other FAQ’s” feature
  2. Fix the front page so that it actually SHOWs the list of FAQs (!)
    • WHY?
      1. The author has made the front page NOT show the FAQs themselves, apart from a “top 10” listing over on the right hand side. This is annoying to users: why would I want to prevent people from reading FAQs if the whole purpose of the site is to read FAQs?
    • HOW?
      1. This is a bit more tricky. The author has made two implementation mistakes when writing the application. Firstly, they appear not to have used one of the excellent mainstread free templating engines for writing HTML. Secondly, when writing/adopting this templating engine, they picked one that requires you to re-define EVERY template item PER PAGE – so commands from the “news” page will never work on the “front” page, for instance.
      2. Find the PHP commands you need which are inside the view categories page (“show.php”):

        ‘writeCategory’ => $PMF_LANG[‘msgFullCategories’],
        ‘writeThemes’ => $category->viewTree(),
        ‘writeOneThemeBack’ => ”));

      3. Copy those PHP commands into the index page (“main.php”), inside the “processTemplate” part, so that now it looks like this:

        $tpl->processTemplate(‘writeContent’, array(
        ‘writeNewsHeader’ => $writeNewsHeader,
        ‘writeNewsRSS’ => $writeNewsRSS,
        ‘writeNews’ => $news->getNews($archived),
        ‘showAllNews’ => $showAllNews,
        ‘writeCategory’ => $PMF_LANG[‘msgFullCategories’],
        ‘writeThemes’ => $category->viewTree(),
        ‘writeOneThemeBack’ => ”,
        ‘writeNumberOfArticles’ => $PMF_LANG[‘msgHomeThereAre’] .
        $faq->getNumberOfRecords($LANGCODE) .
        $PMF_LANG[‘msgHomeArticlesOnline’]));

      4. Find the template commands you need in the “view categories” template page (“template/show.tpl”):

        <h2>{writeCategory}</h2>
        {writeThemes}
        {writeOneThemeBack}

      5. Copy those template commands into the “index” template (“template/main.tpl”), and surround them in a div, just before the line “<!– begin news –>”
    • PROBLEMS?
      1. None.
      2. Suggestions: I wish the author had used a real templating engine, instead of this half-hearted proprietary system. It could really do with being ripped-out and replaced with a real one, then any user could make changes just be editing templates, instead of also having to hand-edit PHP files like you do at the moment.
  3. Fix the HTML title so that it is the title of the site, NOT “powered by phpMyFAQ Version 2.0.01123.999blahblahblah”
    • WHY?
      1. A lot of “clever” sites and applications use the Title tag of a page to determine its Content these days, and the hardcoded very long title causes occasional problems.
      2. It’s fine having “powered by …” plastered all over your FAQ site, but not where it conflicts with the ideals of the HTML spec (which defines Title as the document/content title, not a bunch of advertising), and/or damages your Google ranking
    • HOW?
      1. Edit index.php: change this line:

        $title = ‘ – powered by phpMyFAQ ‘ . $faqconfig->get(‘main.currentVersion’);

        to this:

        $title = ”;

      2. There are two occurrences of that line in that file, I changed both of them
    • PROBLEMS?
      1. None.
  4. Add a link from the Admin site back to the front page
    • WHY?
      1. When you’re on the front page, there is a link to the Admin site, but from the Admin site there is no link back to the front page, so there is no way to see/test your content
    • HOW?
      1. Edit admin/header.php: Change this line:

        <h1>phpMyFAQ <?php print $PMF_CONF[‘main.currentVersion’]; ?></h1>

        to this:

        <h1><a href=”<?php print $PMF_CONF[‘main.baseHref’]; ?>”>Home</a> <?php print $PMF_CONF[‘main.currentVersion’]; ?></h1>

    • PROBLEMS?
      1. None.

8 thoughts on “Small Fixes for phpMyFAQ”

Comments are closed.