Fog Creek Software
Discussion Board

Knowledge Base
Terry's Tips
Darren's Tips

Having some trouble

I've been trying to get CD to do some magic i'm sure it's capable of, but seem to be out of magic-powder.

So here's what i'm trying to get to work, and you tell me if you know a way to actualy make it work.

I'm building a site that's supposed to hold CD (that is, Compact Disc) reviews. The index page holds a listing of the five latest CDs added to the archive. no problem there. Each CD has its own page, with a template that shows
CD title: "(headline)"
Artist: "(author)".
now, that too (and some other stuff other than that) works swell. the actual problem is this:
i want to link the (author) to a seperate page, dedicated to the artist. since this is all a part of the template the link needs to be generated automaticly, using a script.
using [a href="..\artists\{$ .author $}"] works after i've created the file -- but only if the artist's name (i.e., (author) is under a given number of charecters!
anybody got a clue?
listing on the artists page all the Compact Disc reviews he's got is another hellish problem, which i'm not even near solving.


i hope some of you CD (City Desk this time) wizards can understand what i'm talking about, and perhaps even help me out a bit. thanks, me.

john doe
Saturday, August 2, 2003

For the second problem, there is a condition that you can use in cityscript called author. IE
{$ foreach x in (author "{$ .headline $}") $}
<a href="{$$}>{$x/headline$}</a>
Notice .headline, not x.headline. Assuming you are using .Headline of the author's page for their name. Substitute whatever makes sense...

Israel Orange
Saturday, August 2, 2003

What is the number of characters?

Israel Orange
Saturday, August 2, 2003

John, I don't think CityScript is quite ready to do your CD listing by artist right out of the box. I think you need a nested loop' a much requested feature.

You can accomplish what you want with a little brute force in each review and on your artist page: When you add a new artist, you create a new article for the artist and a script that lists his CD's. When you do a review you'll have to link to his article from the review.

I'm sticking my neck way out here. This might work presuming you have a folder full of artist bio articles.

In your artist bio article: Put the artist name in the author or headline, the bio in the body, put the script that generates his list of CD's in extra1. The template for your artist page: has {$.author$} {$.body} and {$.extra1$}  so you get a name, a bio, and a list of CD's.

For a page that lists all the artists and their CD's, you foreach throught the artist folder and produce an {$$} and an {$x.extra1$} and maybe a "read bio" that links to the artists' bio. So you get the artist, a script that lists his CDs, a link to the bio; then the next artist ...

I'm just speculating, seems like it might work even if it takes more effort than we'd like.

Saturday, August 2, 2003

Israel Orange,
it seems that the file-name length is 25 chars (soledadbrothers-soledadbr.html - yes, i counted), in case you're curious.

in my previous post i failed to explain the problem correctly. the problem isn't with artists having more than 25 chars in their name (they are rare enough, and i can use shorts for them), the ACTUAL problem is with artists with two different words in their name.  e.g.,

in file CDs\sonic youth - daydream nation
the template's script reads {$ .author $} as "sonic youth". so linking [a href="../artists/{$ .author $}.html] gives me the link as "../artists/sonic youth.html", which is the right path, but not file name. with artists with a single-word-name it works. but with 2 words for a name it doesn't. simply because when CityDesk compiles the site it gives out the filenames w/out spaces.

any clues about it?

that seems to be the MAJOR problem. i still haven't haven't solved linking all the artists CDs from his own "bio" page, but it seems fairly simply. just runing a loop that reads his {$.author$} as the condition in the CDs directory.
well, i tried it before and it didn't work, but i reckon if i play enough with it it will.


and thanks everybody for the quick responses

john doe
Sunday, August 3, 2003

Just some more..

i tried working out the "linking all the artists CDs on his bio page" problem.

i tried out putting in the template:
{$foreach x in (author "beck") sortDescendBy .filedDate $}
[a href="{$$}"] ....

it worked perfectly well showing all of Beck's cd reviews (using (and(folder "CDs") would probably refine the loop to looking only to the CD dir, but that's still ahead). but i want it to work automaticly to *all* of the artists.

so i tried
{$foreach x in (author "{$ .headline $}") sortDescendBy .filedDate $}
[p][a href="{$$}"] ....

the headline (in the artists template) is the artists name. the author (ind the CDs template) is the artists name. it should have worked smoothly. alas, it didn't. it seems the CityDesk can't cope with {$ script ({$ .script $}) $}. any way to work around it?

john doe
Sunday, August 3, 2003

I hope i'm not being too much of a nag, but i just tested some more and realized a few things:

Israel orange,
your suggestion to use the (author "{$ .headline $}") condition would have been the perfect solution to the CDs listing page. but for some reason City Desk doesn't accept it.

i used the template to call for {$ .extra2 $} in each individual page. in each page i'd copy-paste some CityScript that does the said (author "{$ .headline $} condition, and replace the {$ .headline $} with the artists name manually. it's not the best solution, but would it have worked i would of been happy. apparently CityDesk doesn't run CityScript from {$ .extrax $}.

and the problem with linking from the CD review to artist with a two-word name still persists..

john doe
Sunday, August 3, 2003

Maybe you should read up on keywords.  Include as many as you like for any particular article.  In the case of artists, include "artist" as a keyword in each artist article.

Then you can loop on keyword "artist"

Joel Goldstick
Sunday, August 3, 2003

I don't have a problem seperating the artists' pages from the cd reviews. the simple solution was just just to put them in seperate directories. its also a whole lot simpler to manage that way.

so what about making

{$ foreach x in (and (author "{$ .headline $}")(folder "CDs")) sortDescendBy .filedDate $}
<p><a href="{$ $}">{$ x.headline $}</a></p>{$ next $}


john doe
Sunday, August 3, 2003

*  Recent Topics

*  Fog Creek Home