Saturday, December 29, 2007

Examples for my tips

This template:

<b:includable id='main'>
<hr/>
<h2><data:title/></h2>
<hr/>
<data:content/>
<hr/>
<b:include name='quickedit'/>
</b:includable>

should always be enclosed in the underlined, bolded tags. A template without b:includable tags will not upload to Blogger.

Any "plus sign":

<a expr:href='data:blog.homepageUrl + "index.html"'>

should always be led and trailed by spaces, because the form handler doesn't know the difference between a plus sign and a space (which becomes a plus sign in the query string) and may change it to a space, rendering expressions unparsable and forcing your entire widget out of your blog! But if a leading and trailing space are included, " + " in the form variable becomes "+++" in the query string, which magically turns back into " + " when the string gets parsed.

Form data in the template:

<a href="http://not-a-domain.com/example.php?sample1=always&sample2=expand&sample3=ampersands">

should become, in the add-widget form:

&lt;a href="http://not-a-domain.com/example.php?sample1=always&amp;amp;sample2=expand&amp;amp;sample3=ampersands"&gt;

The first amp; is to overcome a deficiency in the publishing engine. The second amp; is to ensure safe passage through the form handler. If you were hard-coding this example in Template edit, you would need only one amp;:

<a href="http://not-a-domain.com/example.php?sample1=always&amp;sample2=expand&amp;sample3=ampersands">

The publishing engine will automatically change &amp; to & in your page.

I’ve already given the code for the quickedit icon, but here it is again:

<b:includable id='main'>
<hr/>
<h2><data:title/></h2>
<hr/>
<data:content/>
<hr/>
<b:include name='quickedit'/>
</b:includable>

No comments: