Categories
server admin

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 replies on “Small Fixes for phpMyFAQ”

Adam –

I’d really like the FAQ to allow you to browse the entire FAQ list (I was hoping the site map would do this – WRONG!).

I want a tree view!

Also, I’d like to have the same questions in multiple categories (this was the driver for my selection of Serendipity as my blog tool).

Very impressive work on iPhone development help (I’ve been “iP-curious”, but not focused of late). Thanks.

I have now found so many bugs with phpMyFAQ that I’m seriously considering writing a whole new FAQ system from scratch. Looking at how much in phpMyFAQ that is broken, if I carry on using it I’ll probably end up rewriting about a third of it just to get it to work :(.

But … who has the time for this? :(

What I forgot:

“Add a link from the Admin site back to the front page ”

There’s a link on the admin start page to the front page in the quicklinks box.

-Thorsten

I’m afraid you made it so hard to contribute, and the problems I encountered just kept getting so much worse and worse, that I gave up.

I was quite disappointed with the presence of such glaring “critical” bugs when I wrote that, so it might sound more negative than intended. I think there are some great bits about phpmyfaq – hey, I’m still using it on my site while I write a replacement – but…

You never even “allowed” (manual registration review!) me into the primary forums where people look for help.

There are very brief “quickstart” usage notes, but no documentation, and no source documentation.

I hit problems in the source where something you were doing was causing the source chnages to be ignored (I guess you do page caching somewhere?). At that point – all undocumented – I realized it would take me so long to fix all the bits I needed to change that I’d be better off writing my own.

in less than three days I had a basic FAQ system working with extra features that PMF doesn’t have. It’s still missing half of PMFs features, and I won’t have another 3 days to spend on it for at least two weeks – but within just one more session I might have a “basic” repacement for PMF that is ten times easier for me to fix and add to.

I’m building from the ground up in standard libraries – e.g. making heavy use of PEAR – and for some people that’s what we need.

For other people, phpMyFAQ may be perfect. But it just isn’t good enough for me. Sorry.

In case it’s not obvious: I’m not recreating all the features of PMF – just the ones I need. I’m not saying you can rewrite PMF in 1 week, but maybe if you only incluse the parts I need, you can.

Although…using other peoles libraries (like PEAR) does save a *massive* amount of time. It’s impressive how much you can make how quickly if you design your app to fit within the narrow constraints of the libs.

Hi!

I activate the forums user manually because of spam. If you tell me your username I can activate you. And I would really appreciate to get your fixes into phpMyFAQ.

I started phpMyFAQ almost 8 years ago and that’s the reason of the current state. I cannot use PEAR because of license issues and in 2000 we had nothing like Zend Framework.

Hi,

I wonder – HOW – can I switch out the present version of ‘tinyMCE’ editor (which is broken)? I actually tried to do it by getting the latest version of tinyMCE. I then renamed the existing folder “editor” under “admin”-folder in phpMyFaq – and created a new folder called ‘editor’. I then copied the files and folders from latest tinyMCE-version into that editor-folder (I copied also the *.html files from the original ‘editor’-folder).
=> But – this new version of tinyMCE won’t load at all in phpMyFaq….

** ALTERNATIVELY ** How can I use a different editor than ‘tinyMCE’. I “fell in love” with this one: http://xinha.webfactional.com/
I tried the demo — and was hugely impressed…. I tried to install it in phpMyFaq (following the Xinha-instructions – and also disabling tinyMCE in “header.php”)…. but no luck at all…

Anyone??

Comments are closed.