Most Popular Posts

At the moment, my list looks like:

{is_aside}

Blogsome has a Smarty Tag called {is_aside}. This is a test of that.

WYSIWYG editing for Blogsome

I’ve spent a bit of time working on getting some plugins working under Blogsome. In particular, TineMCE-Wordpress and WYSI-Wordpress. Neither of them worked too well, and they both just removed the Quicktags. I’ve also downloaded the TinyMCE source: I may implement a subset of that in a single file, and get that working with Blogsome. I also tried getting the Gravatar plugin to work, but this fails, as the Post Editor seems to screw up the tags, putting in a close tag. And self-closing the tag fails. <gravatar matt@schinckel.net> becomes <gravatar matt@schinckel.net></gravatar> And <gravatar matt@schinckel.net /> gets changed into <img class=“postgrav” src=“wp-content/gravatars/blank_gravatar.png” alt=“a gravatar image”> by the plugin, not what it should look like. Which, by the way, isn’t Valid XHTML! Note: these are not installed on the actual Blogsome server, but a Test one.

The More I See You • [Chris Montez][4] • [Room Service][5] ★★

[4]: http://www.google.com/search?q=%22Chris Montez%22 [5]: http://www.google.com/search?q=%22Room Service%22

Better Quicktags

Some time ago, I wrote a replacement script for the Quicktags that are present in the Blogsome backend. It seems that they have been implemented! You now have the ability to put <abbr> and <acronym> tags into a post, quickly and easily. Also, it’s possible to get the characters < and >, without having to remember what they look like. Try it out!

Gravatar Smarty Modifier

I wrote a Gravatar modifier for Smarty: {$comment->comment_author_email|gravatar:"default":     size:"rating":border} For example, to use no default image, and limit the size to 40x40 pixels, you’d use: {$comment->comment_author_email|gravatar:"":"40":"":""} Notice the double quotes where the argument is missing, and that (in this version) you actually need to include all of the arguments. (I’ve updated this, but haven’t tested it fully yet). Anyway, here’s the code:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
    <?php
    /**
     * Smarty plugin
     * @package Smarty
     * @subpackage plugins
     */
    
    
    /**
     * Smarty gravatar plugin
     *
     * Type:     modifier<br>
     * Name:     gravatar<br>
     * Author:   Matt Schinckel<br>
     *           mailto:matt@schinckel.net<br>
     *           aim:mschinckel<br>
     *           http://schinckel.net<br>
     * Purpose:  convert email address to gravatar
     * @param string
     * @return string
     */
    function smarty_modifier_gravatar($email, $default=false, $size=false, $rating=false, $border=false)
    {
        $gravurl = "<img src='http://www.gravatar.com/avatar.php?gravatar_id=".md5($email);
        if ($default)
        {
            $gravurl = $gravurl."&amp;default=".urlencode($default);
        }
        if ($size)
        {
            $gravurl = $gravurl."&amp;size=".$size;
        }
        if ($rating)
        {
            $gravurl = $gravurl."&amp;rating=".$rating;
        }
        if ($border)
        {
            $gravurl = $gravurl."&amp;border=".$border;
        }
        return $gravurl."' alt='Gravatar Image' />";
    }
    
    ?>

Tidying up Blogsome Forums

I’ve been keen for a while now to go through the Blogsome Forums with a bit of a broom - there are lots of duplicate threads and topics that could be pruned, and some stuff probably belongs in different forums. The recent server troubles have generated a flurry of posts, some of which were total duplicates, and some of which were even in the wrong forums. I think for instance, that a lot of the stuff that is in FAQ should be moved elsewhere, and have this as a place where a really well thought out list of questions, with complete answers, is listed. Perhaps this forum can be limited to a subset of users, and they can create new posts here with answers from other questions asked throughout the forums. I’d love to hear from some of the other users about this idea, particularly people who might be interested in helping with the writing of actual FAQs. I wrote a significant rant/rave in the forums about this issue… it will be interesting to see if it gets any replies.

Blogsome Templates

Say you find a Blogsome site, with a template you really like. You ask the author for the data, but they don’t reply to you. Never fear. You can always get the data from a Template, as this data is world-readable:

You may need to right-click and Save As…, or view source to see them properly. Obviously, for blogs other than mine, replace _schinckel _with the relevant word… I’m working on getting this so the source of the current templates can be viewed in another web page, but there are some issues with this. The iframe/object will only display the rendered value, and CSS files don’t display at all.

{todayayearago}

Another Blogsome user was wanting to use {todayayearago} to get posts from a week ago, which reminded me I do it with a month ago. Looking through the source to see if a weekly one exists (it doesn’t, as yet), I came across this little nugget:

1
    function todayayearago( $when, $wpblog, $spacer ='<br /' )

Now, ignoring the apparent typo (I think there should in fact be a closing tag to that there BR tag…), what do you see that is notable? That’s right, you can choose a different blog. So I tried this with my test blog:

    {todayayearago when='month' wpblog='schinckel'}
    {if $todayayearago != ''}
        <h2>A Month Ago</h2>
            <ul>
                {foreach from=$todayayearago key=id item=details}
                    <li>
                        <a href="{get_permalink id=$id}" title="{$details.content|truncate:25:"..."}">
                            {$details.title|truncate:20:"..."}
                        </a>
                    </li>
                {/foreach}
            </ul>
    {/if}

Now, this gives some very interesting results. Firstly, it works, except for the part that tries to get the permalink:

href="{get_permalink id=$id}"

This fails, because it (naturally) tries to grab the permalink from the current blog, not the other one. My next step was to see if {get_permalink} can handle an argument like wp_blog. The sad news is it can’t. So, the next question is: does the URL get returned in the data structure along with the content and title. I suspect so, but need to see how. Looking through the source of wp-db.php doesn’t throw much light on the topic, so it’s time for trial and error. That’s what a test blog is for, after all! Aha! You can see most of what happens from the todayayearago file itself:

1
2
3
4
5
    foreach( $reqhistory as $row )
    {
     $todayayearago[ $row->ID ] = array( "title" => strip_tags( stripslashes($row->post_title) ),
      "content" => strip_tags( stripslashes( $row->post_content ) ) );
    }

Which clearly shows that only the title and content are ‘grabbed’. So, until I rewrite this function (so it includes the URL, and perhaps even so it allows for other intervals), it’s use is still limited to posts within your own blog, from either a year or a month ago. Unless I can find a way to get post data from another blog’s database…

Monthly Archive Problem Solved

Ronan has fixed the monthly archive issue on Blogsome. That is, you can now affix page/2/ to any URL (or at least I haven’t found one where it doesn’t work!), and it will show any items that are not in the top 10 (by default, changable in settings). This also works for page/n/ in general. This used to work only for the main page and categories. It now works for monthly, yearly and daily archives. The rule Ronan has used is nicer than my 3 - in that there is just one line for all three cases (as far as I can tell):

RewriteRule ^blogs/([_0-9a-z-]+)/([0-9]{4})/?([0-9]{1,2})?/?([0-9]{1,2})?/?page/([0-9]+)/?$ /wp-inst/index.php?wpblog=$1&year=$2&monthnum=$3&day=$4&name=&paged=$5 [L]

I’ll post this to the Blogsome Forums later today.

Interesting Blogsome URL

I’ve been working with one of the Blogsome Admins to try and fix the Archive Pages bug (nearly there, I hope), and he came across an interesting ‘bug’. If you use a URL that looks like: http://schinckel.net////2/ You get a page that has only post titles.