Mon 12th Sep 2005
Archive and Links Pages
Posted lunch time, filed under Blogsome , Smarty Templates.It would be nice to be able to have a links and/or archive page under blogsome: that just had a list of all links, or a list of all posts/months/days (whatever).
The problem is that Pages cannot use template tags, and it is not much fun to update these pages by hand.
A solution presented itself to me today, and it goes like this:
{if $smarty.server.REQUEST_URI == '/links/'}
{get_links_list}
{elseif $smarty.server.REQUEST_URI == '/archives/'}
{get_archives type='postbypost' limit='' format='html'}
{/if}
This code can go into the Main Page template, just after {content}, or into the post.html template if you’ve used my previous hack to get Pages processed by the post template.
You’ll also need to create Pages: Links and Archives (if you use different names, be sure to ensure the page-slug is the one that is listed in the code above). I had to put a <br /> into each Page in order to get rid of all errors.
You can see the results here: Archives, Links.
It’s more than likely that a similar solution exists for categories: I’ll do that too.
Update: Categories, Pages.
Note: Make sure you have the slash following the URL when you try to access them. It may be possible to have a double {if} clause (with slash and without), but I’m not sure yet… [later] works a treat:
{if $smarty.server.REQUEST_URI == '/links/' || $smarty.server.REQUEST_URI == '/links'}
{get_links_list}
And so on…
thanks for the help
26 minutes after the fact.
i’ve put all that into the post.html and nothing shows in my http://jclay.blogsome.com/arcieves/ or
http://jclay.blogsome.com/links/
i can’t figure out why …
3 days, 19 hours after the fact.
Links looks fine: but you are spelling Archives wrong, and I think that is the problem.
Otherwise, seems to be okay.
4 days after the fact.
Hmmmm…not working for me.
created the pages and inserted the code in the right place - I think.
http://crunchy.blogsome.com/archives
http://crunchy.blogsome.com/links
Jeanette
1 month, 3 weeks after the fact.
Oh wise Mr Schinckel, I bow down before you. How on earth dio you find the time to answer all these questions from bumbling bloggers like myself? Funny how something as simple as a slash can make all the difference in the world.
Can you answer me another question - why is it that on my archives page only some of the posts are underlined, while others are not? On my links page, one lone link is not underlined, but the rest are. Bizarre.
Now I’m off to try and figure out how to get a horizontal menu across my header like you - copied the section from your template and tried it in my test blog (http://jeanette.blogsome.com), but ended up with it posting centered at the top of the page, one link below the other. Off to play with code and try to figure it out. After that, I’m going to try and figure out how to get each section of my side bar in a little box, like you.
I’m a shameless copycat - but I”m learning tons.
Many thanks
Jeanette
1 month, 3 weeks after the fact.
Back again.
Figured out the underline thing. Also figured out how to make a category page.
Two more questions - and I promise to leave you alone (at least till tomorrow).
1. Can I add the date after the each post in the archive, or sort them by month?
2. Can I get the posts to list below the categories, or show how many posts in each category?
1 month, 3 weeks after the fact.
1. Not by default. I’ve written a JavaScript to do it, but it isn’t finished yet.
2. No (not real easily, anyway), and yes.
{list_cats optioncount='1'}As for getting posts, you may be able to find a function that will put archives according to category, but I’m not sure as yet.
1 month, 3 weeks after the fact.
Thanks a million, I thought I loved blogging before, but now I can’t wait to implement more cool things into my blog! It works great! And now I can save the time and hassle of maintaining an archive page on my own. WOOHOO!
4 months, 2 weeks after the fact.
Thank’s a lot. This is very useful! Very nice work!
6 months, 1 week after the fact.
What would we do without you schinkel?!?!
7 months after the fact.
Is there some paramethers that can show all posts, separated categorie by categorie?
8 months, 3 weeks after the fact.
No, I don’t think there is. One reason for this is that posts may be in multiple categories, so they would appear multiple times in the list.
This may be possible with a standard WP plugin, which could be rewritten for Blogsome. If you find such a plugin, I’ll try making it work with Blogsome.
8 months, 3 weeks after the fact.
how about the popular posts and categories. what is the code?
still a bit lost
9 months after the fact.
If you have a look at my template page, http://schinckel.blogsome.com/template/, then you can see the actual code that is used.
I haven’t done one for popular posts, since that code is just in my sidebar section of my template anyway.
9 months after the fact.
well i managed to get the archives showing on my archives page but i don’t seem to be able to style them to get rid of the list-style.
also how did you get it to display the month and year in your archives demo?
1 year, 5 months after the fact.
I use a neato little JavaScript to post-process the data that the system generates for me. I can’t really post it here, but if you View Source… on the archives page, and scroll down, you’ll find it.
1 year, 5 months after the fact.
Hi Schnickel. I`m a java basic coder who knows shit abt wordpress & scripting. But my fiance fell in love with the WED-site layout at firstphera.com but was disappointed when she saw they charged!
(http://www.firstphera.com/aarvin)
SO i tried mirroring the same for her at http://ittakestwo.blogsome.com
After hunting & experimenting using ur code help, i`ve managed to make our /welcome page content as the main content u see when u come to the site.
However, i used the code to get the latest post to lead to the OUR BLOG link on the right menu panel. I need it to show the latest post with prev & next buttons minus the comment space etc - this shows coz user ends up clickin the actual post page instead of leadin to the blog page as blogsome wud have normally shown.
Can u help?
I led the OUR BLOG Link to the following :
{$title|truncate:20:”…”}Our Blog
Plz help! Plz plz plz! I wanna do this for her!
2 years, 7 months after the fact.
Sorry mate, I don’t have anything to do with Blogsome site development any longer.
I think I’ve forgotten most of what I know about Smarty Tags, too.
2 years, 7 months after the fact.
Damn! I`ve been scavaging thru the entire www & all ur posts on the forum tryin to learn as much as i can to help myself out.
Can u atleast point me to someone who cud help?
2 years, 7 months after the fact.
Sorry, I have no ideas. There were a couple of other people fiddling around with templates and stuff, but I basically had to learn everything by trial and error.
My suggestion: make a second blog that you can use for fiddling, that way if you screw something up, it doesn’t matter.
2 years, 7 months after the fact.