WSN Gallery
Country Flag Icons
Country Flag Icons
By Paul

Suppose you want a flag icon to mark which country a listing is in. Download the flags collection at the bottom of this article. Extract the zip and upload the flags directory from it to /templates/images_default so that it becomes templates/images_default/flags (or images_yourthemename for other themes). Then create a listingflags.php file with this content:
<?php
$pseudomethods[] = 'countryflag';
function countryflag($object)
{ // return flag image
global $settings;
if ($object->country) $flagimg = strtolower(getcountrycode($object->country));
if ($flagimg && file_exists($settings->imagespath().'/flags/'.$flagimg.'.png')) $ret = '<img src="{IMAGESURL}/flags/'.$flagimg.'.png">';
else $ret = '';
return $ret;
}
?>

Save that in your /modifications/ directory (if the directory doesn't exist, create it). You can now use {IMAGECOUNTRYFLAG} in your templates to display the flag. You'll probably want to put it in the listing bit template (Admin Panel -> Templates -> Manage Templates -> Subtemplates -> Listing Bit).
flags.zip
(166 KB, 26 downloads)

Rating:


4/5 based on 1 vote. The median rating is 4.

Submitted: 03/28/09 (Edited 12/12/11)

Description: Showing a flag to represent the country a listing is in.

Views: 273 views. Averaging 0 views per day.
In the most recent 30 day period, there've been 1 views.

Previous Article | Next Article

Features Showcase Purchase Services Resources Support