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>

Friday, December 28, 2007

Complete Blog Post List

I took what Vin did with his post list here and turned it into a widget! All you have to do is click on the button below, select a blog to add it to, and click their button, and, voila! a complete list of everything you ever posted, right in your sidebar! You may change the widget heading to anything you like, but please, don’t edit anything in the widget’s template, OK? Happy listing!



List heading:

Do not sort the posts.

Sort the posts alphabetically. (NEW!)



Check the sidebar of this blog for an example of this list.

Thursday, December 27, 2007

Tips for including widget templates in add-widget forms

Here are a few tips that might help you avoid the posting mistakes that add-widget makes:

  1. Always enclose your template code in <b:includable id='main'></b:includable> tags.
  2. Always include a space before and after every plus (+) sign.
  3. Always substitute &amp;amp; for every & in all your code. This is not a mistake. The extra amp; is actually necessary.

These tips, if followed religiously, will ensure a safe and successful upload of your widget! Oh, I almost forgot.

  1. Always include the quickedit icon: <b:include name="quickedit"/>

That last one is because if you write your own widget template, the quickedit icon will not automatically be included.