Podcasting is what all of the kids are doing now: basically, from what I can tell, you just have an enclosure that is part of the post, and RSS readers can automatically download them. Blogsome doesn’t really have the ability to upload non-image filetypes (other than by renaming them to have an image-like extension), and anyway file sizes are limited to 300k, but it is possible to have enclosures that are files hosted elsewhere. Anyway, I found a page detailing how to set up enclosures, but it wouldn’t work for me. It turns out there is an array of arrays, and these need to be stepped through. The code I added to display a link to the enclosure after the post is as follows:

 1    {custom_fields}
 2    {if $enclosure != ''}
 3        <div class="enclosures">
 4            {foreach from=$enclosure item=enc}
 5                <div class="enclosure"><b>Attached Enclosure</b><br />
 6                    File: <a href="{$enc.0}">{$enc.0}</a><br />
 7                    Length: {$enc.1} bytes<br />
 8                    Type: {$enc.2}<br />
 9                </div>
10            {/foreach}
11        </div>
12        {assign var='enclosure' value=''} <!-- reset enclosure variable again! -->
13    {/if}

The only part I haven’t got working yet is the Length and Type fields: they are both blank. I’ll work harder….

Blogsome Page Templates

(This is an extension on the previous post). One of the major drawbacks of Blogsome is the handling of Pages _is not complete. You can create and manage Pages, but the display of them is sub-standard: there is no page.html template file as there is for _Posts _(post.html). However, I have figured out a stop-gap method of running pages through a template. I tried first to do this by adding a _Custom Field, as noted in the WordPress Codex, called _wp_page_template, and setting this value to post.html. This did not work, mainly (as far as I could tell) because the value did not ‘stick’. This seems to be a known issue with WordPress 1.5.1. I was able to get enclosure Custom Fields to work (almost: they only ever appeared to be an Array). The next way I figured out how to do it was by finding a variable that has a different value when a Page is being rendered, as opposed to a Post or Index, or Category, or Archive. The variable I discovered is {$smarty.server.SCRIPT_NAME}. This appears as '/wp-inst/pages' or '/wp-inst/index.php' under Blogsome. Fantastic! My next step was to have the following code where {$content} used to be in the Main Page Template:

1    {if $smarty.server.SCRIPT_NAME == '/wp-inst/pages'}
2        {assign var=page value=true}
3        {capture name=the_content}{$content} {/capture}
4        {include file='post.html'}
5    {else}
6        {assign var=page value=false}
7        {$content}	
8    {/if}

The first line, the {if} clause, finds out if it is indeed a page. The second line assigns ‘true’ to the variable {$page}, just as a way of making it less cumbersome to test again later. The third line stores the text that would normally appear in the body of the Page into the variable {$smarty.capture.the_content}. This will be used in place of {$the_content} in the post.html template. The fourth line puts the contents of the post.html file into the HTML stream. Just to be safe, I set the value of {$page} to false before the post.html file gets called normally by the {$content} tag. Then, in the post.html template file, I added the following code:

  • Where the content needs to go: {if $page == 'true'}{$smarty.capture.the_content}{$content}{/if}{the_content} There is no {else} required here, as {the_content} has no value.
  • Where the Post Title normally is, I made it: <a href="{if $page == 'true'}{$Smarty.server.PHP_SELF}{else}{permalink_link}{/if}" rel="bookmark" title="Permanent Link: {if $page == 'true'}{single_post_title}{/if}{the_title_rss}">{if $page == 'true'}{single_post_title}{/if}{the_title}</a> Basically, this replaces {permalink_link} by the URL of the current Page. I’ll have a bit of a think about how multi-page documents work if I can get them working. It replaces the {the_title} value by {single_post_title}, which works quite nicely.
  • I also made it so that the Date information is replaced by a Non-Breaking Space - in my template this means that a nice coloured box appears where the Date normally goes: this box is too small otherwise. {if $page == 'true'}&nbsp;{/if} The date data will be empty, so this should work okay.
  • Finally, I used {if $page != 'true'} ... {/if} to remove information that was not pertinant to a Page, such as the Post time, number of comments, category and so on. I also needed to have the {edit_post_link} skipped in this manner.

I have not yet made comments work properly: I’m not sure that this can be done with this hack, but they will not appear if you just do the things I’ve shown above. If you {include file=comments.html}, you will get the Comment Closed Notification.

Blogsome Pages

It’s no secret the Blogsome doesn’t have working Page Templates. The following code snippet is a starter on formatting of Pages like Posts:

1    {if $smarty.server.SCRIPT_NAME == '/wp-inst/pages'}
2        <!-- Do Stuff Here -->
3    {/if}

At the moment, I’ve only figured out how to get the content to appear twice (!), but it’s a start: it only occurs with Pages! Update: I’ve got it working. It’s a bit ugly at the moment, and I’ll probably redo it with a function, but, still it works. See the Contact and About Pages in the Menubar for examples!

Converting Themes to Blogsome, Part 1

This is the first post in a series that will deal with Blogsome theme conversions. Part 2 can be found at Blogsome Themes, part 2. To begin with, you will need the following things:

  • A blog created with Blogsome. I suggest that if you already have a blog that has posts on it, you create a new one, just to tweak until the theme is just right. That way, your real blog will continue to work, no matter what. I’ll assume you have a Blogsome blog to test on, and know a bit about the backend (Dashboard, and where to find the various options/tools).
  • The files required for your theme. Alex King has a great list of themes, and runs competitions occasionally, so go visit there if you want to find one, and don’t have one already.
  • Firefox, with the EditCSS extension installed, or the [EditCSS][7] bookmark
  • Patience

You should also bookmark the following sites:

  • The [WordPress Codex][8], especially [Template Tags][9]
  • The [Smarty documentation][10]
  • The Blogsome [Forums][11]

I will use the following conventions in this document:

  • Button: a button that you click on. Will look different in each browser - usually it looks like the buttons in your Operating System, but not always.
  • Links that you need to click on will be bold.
  • Code that you modify will either look like this or this
  • Filenames will look like this.
  • Important, or unusual terms will be italic.

Converting a WordPress theme to Blogsome is not always easy, but is very rewarding, and you may learn something along the way. Finally, whilst I have gone to a lot of effort to ensure everything in this document is correct, I take no responsibility for any data loss. You should not have been working on your ‘proper’ blog anyway;).

Starting: Upload Image Files

Okay, let’s get started. The first thing you will want to do is upload all of your image files to your Blogsome blog. This is a much more time consuming process on Blogsome, as there is no automated way to do it. Under normal WordPress installations, you can usually FTP into the server, and dump all of the files you need. We need to click on the Upload button in the backend, and then on the Browse… button. Navigate to where the images you have as part of the theme are on your computer, and select the first one. Click the Upload button. When the page loads, record the information it gives you in a place you won’t lose it. Blogsome doesn’t provide the ability to look at lists of images, so if you forget it, you’ll need to try by trial and error to find it. Most of the images will have names that aren’t mangled by Blogsome’s server, so you should end up with a list of files like: /images/header.jpg /images/search.png /images/logo.gif What files you have will really depend on the theme you are using. There are some standard file names, but don’t expect them to be the same as everywhere else!

Update Style Sheet

You now are ready to insert your Style Sheet data. In the backend, click on Manage, and then on Files. Scroll down to the bottom of the page, and click on Site Style Sheet. After a few seconds, your Style Sheet will appear in the text editing box. We need to replace the entire contents of the text view with the contents of the theme’s stylesheet. This could have one of several names: typically it will end in .css, and more than likely it will be the only one. wp-layout.css, stylesheet.css and style.css are all likely candidates. We now need to examine the Style Sheet, and replace all instances of image filenames with their equivalent URL on your server. You can use relative URLs, so if you find something that looks like:

1        background:url(img/content_bg.gif) repeat;

You will want to make it look like:

1        background:url(/images/content_bg.gif) repeat;

You need to ensure you get every filename - otherwise the correct images will not appear! When you are done, you must save your changes. The Update Template! button will do this nicely. Righto! That’s the easy parts done. Next time, you will learn which template files Blogsome uses, and what data needs to go into each of them. You will also learn how to convert a PHP function to Smarty Tags. The next part of this article can be found at Blogsome Themes, part 2.

[7]: javascript:(function()%7Bfunction%20init()%7Bvar%20newline=unescape(%22%25%22+%220A%22),importCount=0,L=%5B%5D;dead=false;oldCSS=null;x=opener;ta=document.f.ta;ta.select();if(x.editStyles)%7Bta.value=x.editStyles.innerHTML;update();return;%7Dta.value=%22/%20Type%20CSS%20rules%20here%20and%20they%20will%20be%20applied%22+newline+%22to%20pages%20from%20’%22+location.host+%22’%22+newline+%22immediately%20as%20long%20as%20you%20keep%20this%20window%20open.%20/%22+newline+newline;function%20add(s)%7Bif(!s.disabled)%7Bvar%20y=%7Bsheet:s,readable:true,label:%22Imported%22,inline:false,shorturl:%22%22,fulltext:%22%22%7D;try%7Bfor(var%20k=0,m;m=s.cssRules%5Bk%5D;++k)if(m.type==3)add(m.styleSheet);%7Dcatch(er)%7By.readable=false;%7DL.push(y);if(s.ownerNode)%7By.label=s.ownerNode.tagName.toUpperCase()+%22-tag%22;if(!s.ownerNode.getAttribute(%22src%22)&&!s.ownerNode.href)y.inline=true;%7Dif(y.inline)%7By.label=%22Inline%20%22+y.label;y.fulltext=fix(s.ownerNode.innerHTML);%7Delse%20if(s.href.substr(0,13)==%22data:text/css%22)%7By.shorturl=%22%20contained%20in%20a%20data:%20URL%22;y.fulltext=fix(unescape(s.href.slice(14)));%7Delse%7B++importCount;y.importtext=%22@import%20%5C%22%22+s.href+%22%5C%22;%22;y.shorturl=%22%20%22+s.href.split(‘/’).reverse()%5B0%5D;if(!y.readable)%7By.fulltext=%22/%20Out-of-domain;%20imported%20above.%20/%22;%7Delse%20if(s.href.substr(0,5)!=%22http:%22)%7By.fulltext=%22/%20Non-http;%20imported%20above.%20/%22;%7Delse%7Bvar%20loadingText=%22/%20Loading%20(%22+(L.length-1)+%22)%20/%22;y.fulltext=loadingText;var%20p=new%20XMLHttpRequest();p.onload=function(e)%7Bta.value=ta.value.replace(y.importtext+newline,%22%22);y.fulltext=p.responseText;ta.value=ta.value.replace(loadingText,fix(y.fulltext));ta.value=ta.value.replace(firstNote+newline,%22%22);%7D;p.open(%22GET%22,s.href);p.send(null);%7D%7D%7D%7Dfunction%20fix(s)%7Bwhile((s%5B0%5D==newline)&&s.length%3E1)s=s.slice(1);while((s%5Bs.length-1%5D==newline)&&s.length%3E1)s=s.substr(0,s.length-1);s=s.replace(/@import.;/ig,function()%7Breturn%20%22/%20%22+RegExp.lastMatch+%22%20/%22;%7D);return%20s;%7Dfor(var%20i=0,ss;ss=x.document.styleSheets%5Bi%5D;++i)add(ss);var%20imports=%22%22,main=%22%22;var%20firstNote=%22/%20Style%20sheets%20whose%20contents%20could%20be%20loaded%20were%20/%22+newline+%22/%20imported%20instead.%20%20Rule%20order%20may%20be%20incorrect%20%20%20/%22+newline+%22/%20as%20a%20result.%20/%22+newline;if(importCount)%7Bta.value+=firstNote;%7Dfor(var%20i=0;ss=L%5Bi%5D;++i)%7Bif(ss.importtext)%7Bimports+=ss.importtext+newline;%7Dmain+=%22/%20%22+ss.label+%22%20style%20sheet%22+ss.shorturl+%22%20*/%22+newline;main+=newline;main+=ss.fulltext;main+=newline;main+=newline;main+=newline;%7Dta.value+=imports+newline+main;update();%7Dfunction%20update()%7Btry%7Bif(!x%7C%7Cx.closed)%7Bta.style.backgroundColor=%22%23ddd%22;return;%7Dx.editStyles;%7Dcatch(er)%7Bta.style.backgroundColor=%22%23fdc%22;setTimeout(update,150);dead=true;return;%7Dif(dead)%7Bdead=false;ta.style.backgroundColor=%22%22;oldCSS=null;%7Dif(!x.editStyles)%7Bvar%20newSS;newSS=x.document.createElement(%22style%22);newSS.type=%22text/css%22;x.document.getElementsByTagName(%22head%22)%5B0%5D.appendChild(newSS);x.editStyles=newSS;oldCSS=null;for(var%20i=0,ss;ss=x.document.styleSheets%5Bi%5D;++i)ss.disabled=true;%7Dif(oldCSS!=ta.value)%7BoldCSS=ta.value;x.editStyles.innerHTML=ta.value;%7DsetTimeout(update,150);%7Dy=open(‘’,’’,’resizable,scrollbars=yes,width=550,height=520’);y.document.write(‘%3Ctitle%3EEdit%20Styles%3C/title%3E%3Cstyle%3E.ec%20%7B%20width:%20100%25;%20height:%20100%25;%20border:%20none;%20margin:%200px;%20padding:%200px;%20%7D%3C/style%3E%3Cbody%20class=%22ec%22%3E%3Cform%20name=%22f%22%20style=%22margin:%200px;%22%20class=%22ec%22%3E%3Ctextarea%20name=%22ta%22%20wrap=%22soft%22%20style=%22margin:%200px;%20border:%200px;%20width:100%25;%20height:100%25;%22%20class=%22ec%22%3E%3C/textarea%3E%3Cscript%3E’+update+init+’init();%3C’+’/script%3E’);y.document.close();%7D)() [8]: http://codex.wordpress.org [9]: http://codex.wordpress.org/Template_Tags [10]: http://smarty.php.net/manual/en/ [11]: http://www.blogsome.com/forum/index.php

Internet Explorer Blocking

I just noticed a lovely little “Privacy Report” icon in the corner of my Blogsome Dashboard pages. Clicking it revealed the following: MS IE 6 Privacy Report: Blogsome Dashboard. I wonder what the rule is: is it to stop anything with the word Firefox in it?

Using /commands in Adium

I had a thought as to why it might not be a good idea to use /commands, instead of %_commands in Adium. If the text you type is part of a URL, then it will be replaced by the substituted text. For instance, http://itunes.schinckel.net/ would be replaced by http:/♫ The Chemical Brothers (Feat. The Flaming Lips) • The Golden Path.schinckel.net/, which is probably not desired behaviour. I’m not sure if this is a big enough deal for me to stop using them. I did also note that an afp:// had a smiley inserted into it instead… Update: You can add the following to the Info.plist:

1                <key>Prefix Only</key>
2                <true/>

Where the keyword appears. This will mean that the tag must be at the start of a ‘word’ for it work. Thanks, Reikon!

Domain Transfer

I’m transferring my domain over to new nameservers, this means there may be a slight interruption to mail and url forwarding. Apologies if I don’t get an email you sent me…

Adium Multi Chat

I had to fix a couple of things in my Adium Scripts tonight: I figured out that if you are a chat with more than one person (like in a Jabber ‘room’), and you use serviceClass of contact of the active chat of the first interface controller you will get a list of items, not just one. Actually, you always get a list, just usually it’s only one item long. So, to test if the chat serviceClass is in a set that can handle HTML in chats, you need to use first item of serviceClass... instead of just serviceClass... Note that this returns correct values, wheras serviceClass of chat 1 (where it is a group chat) will return an empty string. Bad coding, Adium. Anyway, I’ve fixed /who to work with multi-person chats, too.

Phase One of iTunes Chat Client

I’ve started phase one of the iTunes controller bot: I’m downloading the jabber server for MacOS X. ` $ sudo port install jabberd ` Phase Two will soon be underway: I’ve also downloaded the source of a Python bot… more to come soon! Actually, getting the jabber server to work wasn’t as easy as it should have been: I’m using a private jabber account on a server only I know about, but I’ll post more stuff as I get it working. Python looks to be an easy way of getting the bot to work: it would be nice to be able to do it all in AppleScript though. I can’t believe I just said that!

Wall Gone

Well, today was a busy day. Beginning at 8:45, we removed 2.5m of the wall between the kitchen and the lounge. The cavity doesn’t go right up to the ceiling, but is at about normal door height. Apologies to everyone, but this is avery photo-heavy post. To start with, we drilled three holes in the wall, well above where the cavity was going to be. Then we inserted Ø40 steel bars through the wall, and supported them with upright adjustable stands. We used a large piece of timber to keep everything stable. Imgp0483 Imgp0488 Imgp0493 Then we cut out the section where the C-Channel Lintel was going, and inserted that in. Imgp0524 Imgp0526 Imgp0529 Finally, we removed the section of wall that was no longer required. Imgp0547 Imgp0549 Imgp0561 There’s still a lot to do: for instance, we are actually going to insert some vertical supports, just because we are chicken and don’t believe the engineer! (Well, Jaq is anyway). As you can see from this last set of photos, there were quite a few bessa blocks removed! Oh, and we got the smaller wall between the lounge and dining rooms ready to knock out as well. Imgp0562 Imgp0554 Imgp0569 Oh, and the last image is me just showing off the macro function in the camera I borrowed from work.