Archive for March, 2007

FCKeditor extension for Vanilla: long URLs don’t work

Tuesday, March 20th, 2007

The FCKeditor extension for Vanilla is a great plugin that (obviously) enables the FCK editor for forum posts, including an easy way to posts videos from the major online video sites (Youtube, Google Video…).

There’s one issue however I’ve been struggling with: some long html links simply did not display, i.e. a xhref=”http://somelongurl” mce_href=”http://somelongurl” was in the database, but in the html output the href attribute simply was missing.

This turns out to be configurable in /extensions/FCKeditor/settings.php (line 6):

// $FCKeditor_allowed_tags = array( 'a' => array('accesskey' => 1, 'class' => 1, 'href' => array('maxlen' => 100), 'tabindex' => 1, 'title' => 1, 'target' => 1, 'onmouseover' => 1), // modif pvh 20070320 maxlen modified urls -> up to 300

$FCKeditor_allowed_tags = array( ‘a’ => array(’accesskey’ => 1, ‘class’ => 1, ‘href’ => array(’maxlen’ => 300), ‘tabindex’ => 1, ‘title’ => 1, ‘target’ => 1, ‘onmouseover’ => 1),

Problem solved!

[tags]Vanilla, FCKeditor, extension, add-on, long url, long urls, links not showing, length, configuration[/tags]

Adding a tab to your Vanilla Menu - the AddGabblyToMenu Extension as an example

Monday, March 19th, 2007

Gabbly is a service with which you can transform any web page to a chat box - simply by prefixing the web page with http://gabbly.com/.

There are lots of situations where this can be handy - in my case, I was asked to create a chat box on a Dutch-language Second Life Forum in case the SL grid goes down (and people flock to the forum in search of an alternative :-).

Let’s implement this with an extra link in the upper menu, and create a the most basic of all Vanilla extensions for it.

How to create an extension?

  • make a subfolder in the folder /extensions, e.g. “AddGabblyToMenu”
  • create a page called default.php
  • you first need to include some information about the extension, as is documented in the Vanilla Wiki:
<?php
/*
Extension Name: Your Extension Name Here
Extension Url: The url to where this extension can be downloaded
Description: A description of your extension
Version: The current version of your extension
Author: Your Name
Author Url: Your personal url
*/

// your code starts here
?>

Typically, your extension will contain some info that’s configurable: names of menus or links (you need to separate them out in order to make them easily translatable), the place on the page where the output of the extension will come.  In Vanilla, you define this respectively  in the “Dictionary” and “Configuration” of the global $Context variable:

$Context->Dictionary['AddGabblyToMenu'] = ‘ChatBox’;
$Context->Configuration['TAB_POSITION_GABBLYCHAT'] = ‘80′;

So now we want to add our Gabbly Link to the Menu.  The $Menu object happens to be another global variable that you can simple call a method “AddTab” from: 

if (isset($Menu))
{
  $Menu->AddTab( 
    $Context->GetDefinition(’AddGabblyToMenu’),       
    
// the menu text
    ‘AddGabblyToMenu’,                               
    // the menu item name
    “http://gabbly.com/”.$Configuration['BASE_URL'], 
    // the menu link
    “rel=nofollow”,                                  
    // extra attributes for the link (optional)
    $Configuration['TAB_POSITION_GABBLYCHAT']        
    // the position in the menu
  );
}

Here you see how to access terms from the dictionary ($Context->GetDefinition()) - and from the configuration (the $Configuration[]) array.  Note that the order of the tabs in the Vanilla upper menu is determined by an integer number.  You’ll find the order of the default menu options defined in /appg/settings.php - you determine your menu tab position by choosing a numer between or greater than those:

// Vanilla Tab Positions
$Configuration['TAB_POSITION_DISCUSSIONS'] = ‘10′;
$Configuration['TAB_POSITION_CATEGORIES'] = ‘20′;
$Configuration['TAB_POSITION_SEARCH'] = ‘30′;
$Configuration['TAB_POSITION_SETTINGS'] = ‘40′;
$Configuration['TAB_POSITION_ACCOUNT'] = ‘50′;

And that’s it!  The only thing you need to do now, is to enable your extension in the adminstration panel and you’re done! 

Remarks:

  • it was only while writing and searching on the Vanilla Community forum that I noticed there alread is a GabblyChat extension for Vanilla (see also extension page, discussion here) - this solution adds a link in the right nav bar.
  • Probably a link in the right nav bar is even better from a usability standpoint, but anyway, Gabbly was a good excuse to show how to add a link to the menu with a Vanilla extension…
[tags]Vanilla, extension, menu, tab order, Gabbly[/tags]