Fog Creek Software
Discussion Board

Knowledge Base
Terry's Tips
Darren's Tips

Inserting Javascript into teaser?

I would like to use a product like haloscan for comments within my CityDesk site, and need to place a bit of javascript into the "teaser" section, and can't figure out how to do this.

I want people to link to the comments form both the article teaser adn the main article. I can set it up within the main article no problem because I can get into the html there, but not with the "teaser" section - any help, ideas, etc.?

Thursday, July 8, 2004

One idea is to create an article with the script you need and use an "Include" that file in your teaser. I guess, you could just do the Javascript once and "include" it wherever you needed it.

Thursday, July 8, 2004

Along the same line, using a variable containing Javascript might achieve the same purpose.

Patrick Thomas

Patrick Thomas
Thursday, July 8, 2004

Good suggestions, but I still run into a problem - if I use Haloscan (not sure if you guys are familiar with it - very cool way of adding a "comments" functionality on your site. The downside is that all the commentary sits on haloscan's servers - well good and bad. Good for you space wise, bad bc of search algorithms)..

But anyway, for Haloscan to work a piece of javascript has to be put into the <head> tag of the page (no problem there - I just pop it into the sites templates) and another bit of javascript each place I want a comments link (which will open a new window with the readers comments). But each comment link script has to have a unique identifier/name for the article I want comments on - so a one size fit all variable or article include that I can just "plug in" wouldn't work - each one has to be unique. I would need a seperate variable or include for each article, doubling the size of articles in the site immediatley. And my current site has close to 100 articles as is (I haven't transferred everything to CityDesk, still in the exploration/set up phase).

I don't need this functionality, but think the idea of having a reader click to see the comments from the teaser would be very useful if they already read the article and just want to see the discussions it generated without having to go to the article itself. Any other ideas?

Friday, July 9, 2004

Previously people have posted about using {$ .absLink $} to insert a unique page identifier.

Friday, July 9, 2004

You can also use the .fileName as a unique ID, but the .abslink might be better; using .fileName requires assigning a unique .fileName to every article (something I try to do anyway).

Saturday, July 10, 2004

*  Recent Topics

*  Fog Creek Home