Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2009-12-22 20:13:22

hcgtv
Plugin Author
From: Key Largo, Florida
Registered: 2005-11-29
Posts: 2,722
Website

Re: Bert Garcia: When all you have is a keyboard

1,035 days after TerraFirma, a newer design.

TerraFirma2, a design by NodeThirtyThree.

On Monday, December 14, I began the conversion to the new theme. It took a day to program the pages, forms and style and another day to add my special tweaks. The rest of the time was devoted to checking articles for proper alignment, site navigation and testing.

One of my special tweaks was an Archives section. When I learned that an article can display other articles, thanks to this TXP tip, the Archives became easier to deal with. Now all I have to do is create a new article at the beginning of the year, and add the following code to it, change the month=”“ and remember to turn off textile.

<txp:article_custom limit="999" section="articles" month="2009" sort="Posted desc">

<txp:if_first_article><ul></txp:if_first_article>
<li>
<txp:permlink><txp:title /></txp:permlink>, 
<txp:posted format="%A %B %d, %Y" />, 
<txp:rah_function call="rtrim" string='<txp:category1 title="1" link="1" />, <txp:category2 title="1" link="1" />' charlist=", "/>
</li>
<txp:if_last_article></ul></txp:if_last_article>

</txp:article_custom>

Each Archive article’s title is just the year, 2009. The url is http://bertgarcia.com/2009, short and sweet. One very nice side-effect to this scheme, is that a URL like http://bertgarcia.com/2006/10/07/google-is-your-friend, which doesn’t exist since I changed the permlink mode, will display the 2006 archive page, no more 404’s.

The only Textpattern plugin I used on this new theme, and probably the only plugin I’ll ever need, is Jukka Svahn’s rah_function plugin. As you can see from the above code block, I use rah_function to strip out the lone comma from the category links, if there’s only one category assigned to the article.

On the Archives section, rah_function came to the rescue again to count the number of live articles on the site:

<txp:rah_function call="safe_count" table="textpattern" where='Section="articles" and Status="4"' />

And also in the footer of an archives article to display the number of articles per year:

<txp:rah_function call="safe_count" table="textpattern" where='Posted rlike "<txp:posted format="%Y" />" and section="articles" and Status="4"' />

While working on this new theme, the Textpattern Tag Reference in downloadable PDF format was a time-saver, thanks Destry.

After the holidays, I plan on releasing this new theme as a download. Creating this new theme made me rethink the Textpattern CMS Themes mechanism, how best to move forward, how can the forms tab be adjusted to accommodate multiple themes, etc.

Lastly, thanks to the Textpattern developers, your CMS is a joy to work with.

Offline

#14 2009-12-22 22:09:44

jstubbs
Moderator
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: Bert Garcia: When all you have is a keyboard

Looks really nice Bert, and thanks for the interesting write up. I think the Archive method might make a good TXP Tip – possibly a follow on from Els’ tip?

Offline

#15 2009-12-23 05:45:12

hcgtv
Plugin Author
From: Key Largo, Florida
Registered: 2005-11-29
Posts: 2,722
Website

Re: Bert Garcia: When all you have is a keyboard

jstubbs wrote:

Looks really nice Bert, and thanks for the interesting write up. I think the Archive method might make a good TXP Tip – possibly a follow on from Els’ tip?

Thanks Jonathan.

Feel free to add the method I laid out as follow up to Els’ enlightening tidbit of information.

Offline

#16 2009-12-26 17:10:52

TWD
Member
Registered: 2009-09-10
Posts: 14

Re: Bert Garcia: When all you have is a keyboard

I’ve been wondering what the best way to get rid of that comma was! And that archive method is interesting. So you have an archives section, and then created articles for each year, and set the section landing so that the most recent year would be displayed? And I’m a bit confused about how 404s are prevented—could you elaborate?

Thanks for the info. :)

Offline

#17 2009-12-26 19:04:32

hcgtv
Plugin Author
From: Key Largo, Florida
Registered: 2005-11-29
Posts: 2,722
Website

Re: Bert Garcia: When all you have is a keyboard

TWD wrote:

I’ve been wondering what the best way to get rid of that comma was!

I was using jnm_categories, then I came upon rah_function.

And that archive method is interesting. So you have an archives section, and then created articles for each year, and set the section landing so that the most recent year would be displayed?

Yes, that’s the way it’s done.

And I’m a bit confused about how 404s are prevented—could you elaborate?

When I launched the site, my permlink mode was /year/month/day/title, a few months back, I changed it to just /title. Visitors were coming in and getting the 404 page, I looked at zem_redirect as a solution, but it seems to be abandoned. After I created the new site, I noticed that visitors were now being shown the archive page for the year instead.

Try this link: http://bertgarcia.com/2009/10/20/philips-voip-151

Thanks for the info. :)

Thanks for asking :)

Offline

#18 2009-12-27 04:07:50

TWD
Member
Registered: 2009-09-10
Posts: 14

Re: Bert Garcia: When all you have is a keyboard

So the redirect just sort of… happens? Is it leftover from the previous permlink mode? I’m just curious about how Txp makes the choice to redirect there instead of showing a 404.

Offline

#19 2009-12-27 19:22:48

hcgtv
Plugin Author
From: Key Largo, Florida
Registered: 2005-11-29
Posts: 2,722
Website

Re: Bert Garcia: When all you have is a keyboard

TWD wrote:

So the redirect just sort of… happens?

Yeah, here’s a link to an article: http://bertgarcia.com/terrafirma2

This also works: http://bertgarcia.com/terrafirma2/wtf

Is it leftover from the previous permlink mode? I’m just curious about how Txp makes the choice to redirect there instead of showing a 404.

That’s just the way it works, the devs could give you a definite answer as to why.

Offline

#20 2009-12-28 17:45:08

TWD
Member
Registered: 2009-09-10
Posts: 14

Re: Bert Garcia: When all you have is a keyboard

Ah, alright. Thanks again. :)

Offline

#21 2010-02-13 11:01:09

jstubbs
Moderator
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: Bert Garcia: When all you have is a keyboard

Hi Bert, thanks for publishing your method. I have added your tip to TXP Tips.

Offline

Board footer

Powered by FluxBB