Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

Script: How to hide headline for certain articles?

I cannot just leave blank the headline field cause I need it for Page title. How can I display the article for the website and hide the heading?

Thanks

CW

Charles W.
Tuesday, November 12, 2002

Please be more specific. When do you want to show it and when not. Different templates, different media (e.g. for printout) etc.

Adriaan van den Brand
Tuesday, November 12, 2002

I want to show it only when it's a real article (ie news, writings, blogs). But I need to hide it when it's a permanent website content like the front page, about, contact info.

Charles W.
Tuesday, November 12, 2002

Use a different template for the articles that you want not to use the headline

Joel Goldstick
Tuesday, November 12, 2002

I put "(NFP)" (short for Not For Publication) in the Keywords field of articles that I don't want to appear in things like recently-added article lists. All my scripts that list articles (as used on index pages) and recent additions (as used on the main page) exclude articles that have "(NFP)" in the Keywords, so that only real articles get listed.

There's more information on my web site:
http://www.pool-room.com/CodeCraft/CityDesk/ContentFragments.html

Darren Collins
Tuesday, November 12, 2002

Darren,

So, what's the script that I can use to display the content but hide the headline for those article that have "certain_keyword" in the keywords field?

Charles W.
Tuesday, November 12, 2002

In the "simple" template that comes with CD there is this code:

{$ if nonblank .headline $}
    <p><strong>{$ .headline $}</strong></p>
...
...
...
{$ endif $}


If you like the simple template, create a new template, copy the simple template script into the new one.  Then, remove the lines above that display the headline on the page

Joel C. Goldstick
Tuesday, November 12, 2002

Thanks. I'll try that script.

Charles W.
Wednesday, November 13, 2002

Joel,

That script didn't work since I don't leave the Headline empty. Reason is I need the headline for my Page Title. I learned from Darren that by using (NFP) I can hide the article.

Now what I need to do is figure out the script to display only the headline for those articles with (NFP) in the keyword field.

Charles W.
Wednesday, November 13, 2002

Sometimes I put the headline in the headline field; sometimes I put it in an extra field.  So, for example, I use the headline as the "headline" to list articles on the home page and extra1 as the "headline" on other pages.

I started a site for a friend.  After a lot of pages we started putting ship's names (which need to be italicized) into the headline field.  We can't do that in the headline field. So I started using extra1 instead.

(Italicizing ship names in picture captions really drives me nuts.)

tk
Wednesday, November 13, 2002

Sorry Charles, I didn't understand what you were trying to do. I thought you were building a list of articles in a loop, and didn't want anything from those articles to appear. My understanding now is that for each article's HTML page, sometimes you want both the headline and the body to be listed, and sometimes just the body. Is that correct?

If that's correct, you could put something (any text will do) in the Extra1 field of those articles where you want to suppress the heading. Then you can use this inside your template:

{$ if blank .extra1 $}
  <p><strong>{$ .headline $}</strong></p>
...
{$ endif $}

Hope this helps.

Darren Collins
Wednesday, November 13, 2002

Darren,

That script worked. Thanks.

Charles W.
Wednesday, November 13, 2002

*  Recent Topics

*  Fog Creek Home