Blogsome Customisations
I want to start listing off a few of the customisations I have made to my blog. Most of them are really simple, cut and paste pieces of code from the Blogsome forum. The main one is the extra pages I have created:
Archive
Categories
Comments
About
Popular Posts
Blogroll
These pages use a “Page”, which is blank and then smarty tags inject some PHP into the page to generate the lists.
So, to implement these for your self do the following…
Create blank pages in your blog by going to Write-> Write Page. You need to give the page a title, this will become the url of your page. So for the Archive page we create a blank page called Archive. Save the page and then head to Manage -> Files.
We need to add some Smarty PHP to our index page. This will put the list into the relevant page when its called.
Look for this section of code…
<div id="content">
{$content}
We need to paste our new code between those two lines.
This is the code we will use…
{if $smarty.server.REQUEST_URI == '/archive/' || $smarty.server.REQUEST_URI == '/archive'}
<div class="archive">Archive...</div><div class="archivelinks">
{get_archives type='postbypost' limit='' format='custom' before='' after='<br/>'}</div>
The finished code looks like this…
<div id=”content”>
<!– this is required for the categories and archives pages to work –>
{if $smarty.server.REQUEST_URI == ‘/archive/’ || $smarty.server.REQUEST_URI == ‘/archive’}
<div class=”archive”>Archive…</div><div class=”archivelinks”>
{get_archives type=’postbypost’ limit=” format=’custom’ before=” after=’<br/>’}</div>
{if}
{$content}
Now, save and reload your blog. You should be able to go to http://yourblog.blogsome.com/archive and http://yourblog.blogsome.com/archive/ and see your archive page.
Within my blog you can find the following code…
<!– this is required for the categories and archives pages to work –>
{if $smarty.server.REQUEST_URI == ‘/archive/’ || $smarty.server.REQUEST_URI == ‘/archive’}
<div class=”archive”>Archive…</div><div class=”archivelinks”>
{get_archives type=’postbypost’ limit=” format=’custom’ before=” after=’<br/>’}</div>
{elseif $smarty.server.REQUEST_URI == ‘/categories/’ || $smarty.server.REQUEST_URI == ‘/categories’}
<div class=”cathead”>Categories…</div><div class=”catlinks”>
{list_cats sort_column=’name’ optioncount=’1’ hierarchical=’1’ children=’1’ list=’0’}</div>
{/if}
{if $smarty.server.REQUEST_URI == ‘/about/’ || $smarty.server.REQUEST_URI == ‘/about’}
<div class=”abouthead”>About…</div>
{/if}
{if $smarty.server.REQUEST_URI == ‘/no-images/’ || $smarty.server.REQUEST_URI == ‘/no-images’}
<div class=”abouthead”>No Images?</div>
{/if}
{if $smarty.server.REQUEST_URI == ‘/comments/’ || $smarty.server.REQUEST_URI == ‘/comments’}
<div class=”abouthead”>Comments</div>
<ul>
{get_recent_comments no_comments=10 comment_lenth=15}
</ul>
{/if}
{if $smarty.server.REQUEST_URI == ‘/blogroll/’ || $smarty.server.REQUEST_URI == ‘/blogroll’}
<div class=”abouthead”>BlogRoll…</div>
<script language=”javascript” type=”text/javascript” src=”http://rpc.blogrolling.com/display.php?r=cb31f8b745d42a59ac4b8fe982625ccd”></script>
{/if}
{if $smarty.server.REQUEST_URI == ‘/popular-posts/’ || $smarty.server.REQUEST_URI == ‘/popular-posts’}
{popularposts}
{if $pposts != ”}
<div class=”abouthead”>Popular Posts…</div>
<div id=”popposts”>
<ul>
{foreach from=$pposts key=key item=hits}
<li><a href=”{$siteurl}{$hits.url}” title=”{$hits.title}”>{$hits.title|truncate:100:”…”}</a>: {$key}</li>
{/foreach}
</ul>
</div>
{/if}
{/if}
<!– this is the end of the required code for the categories and archives pages to work –>
(via Nogz Blogz 3.4)