Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

String manipulation in cityscript?

I am supporting two versions of my weblog. One is the "ink" version, and the articles reside in citydesk as follows: /blog_ink/2004/January/13 where 13 is the name of the article. I also have some entries for 2003/December which are stored similarly. The other version of my weblog is just for the RSS feed. The entries are normal text, rather than ink, and reside in citydesk as follows: /blog/2004/January/13 where 13 is again the name of the article.

What I'd like to do is have the RSS feed give the permalink to the blog_ink article and not to the text version. Currently I can only figure out how to either a) show the text version's link which is not what I want, or b) case out each individual year and month to show the ink version.

What I'd like is a better way to generate the link for the ink version, which should be easy especially since I have maintained a parallel file structure. I tried to do this using variables, but they are at the site level and cannot be assigned to at design time. If this was C# I would do some nice string manipulation to change the text's link into the ink's link (by adding the "_ink" characters in the right place), but not sure what to do in the citydesk context.

Here is my code for casing out each individual month. The code resides in the rss.xml file at the root level.

{$ foreach x in (and (folder "blog/2004/January/*")(keyword_contains "(nonblogentry)")(not (keyword_contains "(nada)"))(not(thisArticle))) SortDescendBy .fileddate $} {$ setDateTimeFormat "English" "dd/MM/yy" "hh:mm" $}
<item>
<title>{$ x.headline $}</title>
<link>http://www.egrigg9000.com/weblog/blog_ink/2004/January/{$ x.filename $}.html</link>
<description>
<![CDATA[
{$ x.teaser $}
{$ x.body $}
]]>
</description>
</item>
{$ next $}

{$ foreach x in (and (folder "blog/2003/December/*")(keyword_contains "(nonblogentry)")(not (keyword_contains "(nada)"))(not(thisArticle))) SortDescendBy .fileddate $} {$ setDateTimeFormat "English" "dd/MM/yy" "hh:mm" $}
<item>
<title>{$ x.headline $}</title>
<link>http://www.egrigg9000.com/weblog/blog_ink/2003/December/{$ x.filename $}.html</link>
<description>
<![CDATA[
{$ x.teaser $}
{$ x.body $}
]]>
</description>
</item>
{$ next $}

Elizabeth Grigg
Wednesday, January 14, 2004

*  Recent Topics

*  Fog Creek Home