Now using smart links!

In addition to my enhanced Markdown plugin, I’m now using Denis de Bernardy’s cool Smart link plugin. This lets me to link to my old posts using only their title, and to categories using only their name.


  1. Martin Geisler:

    Some simple tests of the plugin:

    • A link to the post about making things neat.

    • A link to my PHP Tutorial.

    • A link to a classic book. This “search engine” wasn’t originally supported, but I’ve added it.

  2. Martin Geisler:

    Hmm… only the link to the book worked, and yet the link to my enhanced Markdown post worked when made in the post itself.

  3. Martin Geisler:

    And now that link worked too down here in the comments. So I guess that it is only links made in the post that are available in the comments? Weird, that must be a bug…

  4. Denis de Bernardy:

    Actually, there’s good odds it’s a feature. The bug would come from two plugins interacting poorly.

    To speed things up, I mass query the DB and cache the resulting links for use in other comments, posts, etc. Thus, on first call in a comment, I fetch all $comments as $comment and process all the smart links at once, to avoid 100+ calls to the DB when a highly commented page gets a smart link.

    so basically, to make the threaded comments work together with smart link, you’ll either need to refresh the cache at each node (a poor solution imho) with some kind of refresh_comment_cache function. Or you’ll need to optimize the way the threaded comments gets its comments (a more proper solution).

    i’m not sure i understand what you mean with the ’search engine’ feature

  5. Martin Geisler:

    Okay, thanks a lot for the reply. The fix was a simple as adding
    in the comments.php file provided with the
    Brian’s threaded comments plugin. If anybody is interested,
    then I added this just before the foreach($comments as $c)
    around line 113.

  6. Denis de Bernardy:

    I’d add a if ( function_exists( 'sem_smart_link_cache_comments' ) ) statement in there, but otherwise that’s the way to do it. It would be nice if you reported the fix to the plugin’s author, so other users will not have a similar problem.

  7. Martin Geisler:

    Thanks for the tip — I’ve sent a note to Brian asking him to update his plugin.

Leave a comment