Campsite 2.3 User Guide

Campsite 2.3 User Guide

Select your language:  
    Search:   
<5.2.4.2. Displaying only the most recent feature article on a section page        5.2.5. Building a Home Page Template>

Print / Download:
Available languages: english Last update: 2005-08-04 13:09:27

5.2.4.3. Including Images in the Section Listing

As seen above, the sectiontemplate.tpl will always pull information out of the database and display it in a list format. If we have images included in the article, they will appear on the article page, but how can we display an individual, small image for one article in the section listing?

The answer is quite simple. Create a body field in your Article Type that will only contain the image that goes into the section listing. Let's say we call this variable 'sectionimage'. Then all you need to add in the section listing to display the image is:

<!** print article sectionimage>

This will then generate the HTML code as saved in the database. And in our case that means it will create the image tag including the image. You could even generate a little subtitle for the image in this field when entering the article text and images.


add a note add a note User Contributed Notes
5.2.4.3. Including Images in the Section Listing
Douglas Arellanes  douglas dot arellanes at mdlf dot org
Tuesday 02nd of August 2005 11:12:00 PM
Mugur Rus writes:

Yes, this is an old example but it's not the only way and maybe not the best way.

> What I want to do is display the article's image on the front page - not
> its text - if the 'display on front page' checkbox is ticked. So I presume
> the template language statement would include first an If statement for
> whether the article is on the front page, but how do I tell the parser the
> number of the photo, when this will be changing?

<!** list article onfrontpage is on>
<!** if image 100>
<img src="/cgi-bin/get_img?<!** urlparameters image 100>">
<!** endif>
<!** endlist>

Now, you'll have to come up with a convention like: "all images that are to be displayed on the front page will have the number 100".

The image number is like a label, it's just that you can't name them with words but you have to use numbers. Think of it this way: number 1 is for displaying together with article short intro on the front page, number 10 is thumbnail for headlines (when you display a list of article headlines in a RSS feed), 20 and up are for use in article body fields.

Douglas Arellanes  douglas dot arellanes at mdlf dot org
Tuesday 02nd of August 2005 10:58:00 PM
Note that the Campsite parser will enclose the image in a <table>, and will include the caption whether you want it or not this way.

<5.2.4.2. Displaying only the most recent feature article on a section page 5.2.5. Building a Home Page Template>

  Last update: 2005-08-04 13:09:27
Website powered by Docmint Last update: 2005-08-04 13:09:27
Total page time: 0.662709951401