Flexible Content Management System


How to use a different news story image under the same topic.

Contributed by on Jul 12, 2002 - 07:33 PM

I have two solutions to this problem.

1. Create a topic named “General” and for the topic image use a transparent .Gif file with size 1x1 pixels. Then each time you want to have a specific picture in a news story use the general topic and using and enter an image using an image tag in the main text of your story.

2. Enter an If statement in your theme that will check the first 4 characters in the main text, if these 4 characters are “<img” (that is the main text starts with an image html tag) do not display the topic image and display the one specified in the story main text.

The 1st solution is a fast and very easy, but its not recommended since you will not be categorizing you stories but throwing them under the same general topic.

The 2nd solution is much better coz you will have all you stories categorized in topics which is a good thing, but it will take a few minutes to change your theme.

Both solutions will cause a problem thought if you have 2 or more themes with different topic image alignment.

What should be a proper solution?

Just let the news module let you specify an image that will override the topic image. This is not difficult to implement and it will only have to add a new filed in stories table to hold the image filename.

Paris Paraskevas
Footnote: 1