JQuery selectors and spaces in ids

I know that the general response to the question about using JQuery selectors for node ids that have spaces in them is to not have spaces in ids.  According to the HTML specification, spaces are not allowed.

ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens (“-“), underscores (“_”), colons (“:”), and periods (“.”).

As we live in a world where web browsers are lenient when it comes to standards, developers are inherently lazy, and you don't really want to rewrite too much of someone else's code just to add a simple feature.  You sometimes need to select nodes with ids that contain spaces.

The attribute selector is what you need.  e.g.

$('[id=An id with spaces]').click(function () {
    // Do something here
});

As a side note and something for me to remember.  The change() listener does not work all that well in Internet Explorer.  It's easier to use click()

Advertisements

#iwexpo Zingzam: Collate, enhance, and share knowledge

The online community platform Zingzam was launched yesterday at Internet World in London's Earl's Court exhibition centre.  

 

Come and see a demonstration and sign up for a 30 day — credit card free trial.  You can find Zingzam at E8150, just follow the pink.

 

I haver been a beta user of Zingzam for some time and the product offers a wide range of features.  From it's ability to brand your site in your own (garish) colours and logo with a few clicks of the mouse to the dashboard.   A major feature of the platform to see the current activity and health of your community.

 

Having RSS feeds of the content it is straight forward to user services such as twitterfeed or FeedBurner to syndicate content.

 

I look forward to using more of the features and continue to support the Zingzam community.

 

vBulletin 4 and the Magically Generated Templates

Just been converting some old vBulletin 3.6.x plug-ins to vBulletin 4.0.x and have run across a couple of gotchas.

Do you have problems like:

  • I can't add the output of a custom template to the footer template.
  • I add {vb:raw my_var} to the header and it does not appear on the page.
  • The data that I vB_Template::preRegister is wrong.
  • vBulletin 4 template upgrade problems.

The thing to note here is that when you render your own custom template, the header and footer templates are automatically rendered.  This means that you can not add you output from your custom template to the header of footer templates by using {vb:raw my_template_output}

Follow the example below to update the footer template.

    // Register my_var with the custom template
    vB_Template::preRegister('my_template', array('my_var' => $my_var));
    $templater = vB_Template::create('my_template');

    // Render the custom template
    $my_template_output = $templater->render();

    // Add the output from the template to the footer template
    $GLOBALS['footer'] .= $my_template_output;

As soon as a vB_Template object is created, the following templates are rendered:

  • headinclude
  • headinclude_bottom
  • header
  • footer

Without re-creating the templates again. It is better to append or prepend the data that you need.

I hope this helps somebody.

Another debian urgh moment: This time postfix

I've been tracking down a problem when trying to use gmail's smtp server for relaying.

We are using debian and post fix.

Errors like the following appear:

certificate verification failed for smtp.gmail.com[74.125.47.109]:587: untrusted issuer /C=ZA/ST=Western Cape/L=Cape Town/O=Thawte Consulting cc/OU=Certification Services Division/CN=Thawte Premium Server CA/emailAddress=premium-server@thawte.com
warning: SASL authentication failure: No worthy mechs found

 

The fix on debian:

apt-get install libsasl2-modules

That's right.  When you have SASL installed on debian you also need to install the authentication mechanism modules.  Great.

 

I'll update this post with instructions on how to get your debian MTA server to relay to gmail.