Flags mod addon - flags in posts - Posted (2709 Views)
Starting Member
StudyManSteve
Posts: 11
11
Learning from SiSL's Mini-MOD: http://forum.snitz.com/forum/topic.asp?TOPIC_ID=59909 I have modified it to add the national flag of a given country to a post. A bit of a gimic perhaps, but it got be learning!
Example: [flag="united kingdom"]
Most of my flags are work mule's, found on Snitzbitz at http://www.snitzbitz.com/mods/details.asp?Version=All&mid=142
I had to rename some of them to match the country names used by Snitz, and I've added the prefix "flag_" to all. They are stored in the images folder along with all the Snitz icons.
Also added a button to the toolbar beside the insert image button, and added some code to the javascript file to make it work. Will post details if anyone wants. Could perhaps collect all the little flags addons together in one mod if there is interest, I couldn't find a complete flag mod when I was looking.
Can be tested on http://www.charles.net.nz/forum/ Shouldn't need an account, just use the preview.
To the point: There is a problem - if a link (the link text type) is added in the same post as a flag, the flag will not be displayed. I notice the same problem while typing this post - the {code} tags do not work with links of this type. Is there a workaround?
Code:

function flags(fstring)
set re = new RegExp
re.pattern = "\[flag=("")([a-z\s])+("")\]" ' Pattern: [flag="any amount of letters and spaces"] re.ignorecase = true
re.global = true
set matches = re.execute(fstring) ' find matches
if matches.count <> 0 then
for each match in matches
flagcountry = Replace(Replace(match.value,"[flag=" &chr(34),""),chr(34) & "]","")
changetext = "<img src=" & chr(34) & strImageUrl & "flag_" & flagcountry & ".gif" & chr(34)
& " alt=" & chr(34) & flagcountry & chr(34) & " title=" & chr(34) & flagcountry & chr(34) & ">"
fstring = Replace(fstring, match.value, changetext)
next
end if
flags = fstring
set re = nothing
set matches = nothing
end function
Code also available, with line references, as a text file: http://www.charles.net.nz/steve/function_flags.txt<
 Sort direction, for dates DESC means newest first  
 Page size 
Posted
Retired Support Moderator
MarcelG
Posts: 2625
2625
I've done it differently ; I added custom smilies with the normal smile manager, for example [nl] for the dutch flag and [uk] for the english. Does the same job, with an existing mod. bigsmile<
Posted
Starting Member
StudyManSteve
Posts: 11
11
Many thanks Marcel, your way look neater, I will investigate the smile manager. I assume you would have to specify each country flag individually though.. nevermind, I guess this would be quicker than putting a new mod in place bigsmile
I think I buried my original question a bit - is there an easy way to prevent the flags function being interferred with by links? (see above)<
Posted
Starting Member
Lagzdin
Posts: 13
13
Hello,

I have tried to follow the authors recommendations but it didn't work as nothing happens.
I have got few questions:
1. Images with the flags should be stored at the root directory? 2. I use the following structure for the images names: f0_ru.gif, where ru = country code. Should I change anything at the country code? 3. Should I change any other forum pages?
And the last question: where is it possible to change the view/data that are being displayed in the topis (auhtors names - left side of the topic)

Snitz Forums 2000 Version 3.4.03

Thanks<
Alexey Lagzdin
Hyundai Accent Club Russia
http://www.accent-club.ru/forum
Posted
Starting Member
StudyManSteve
Posts: 11
11
Alexey

This is just an addon to a flags mod, to allow users to insert a flag into their post. It requires a flags mod to be already installed so that it has some flag image files to work with. It does not provide flags in the topics under the authors names, I think there are flags mods out there which do this.
To answer your questions:
1. The images should be stored in your Snitz images directory, that is where other images such as icon_folder_open.gif are stored
2. The code in the text file looks for flag images named flag_country.gif, for example flag_russia.gif . It is probably easiest to name your images like this, with the full country name rather than a country code, because Snitz saves the full country name in user profiles. 3. If you want the authors flag to appear in topics, search around for a flags mod or let me know and I'll dig up what I have put in place. You will need to change topic.asp in a couple of places to do this. I think others have changed the user profile page to include the flag too.<
Posted
Development Team Member
-gary
Posts: 406
406
I've done almost the same with my forum. Beware though, if you use the inputed country for any sort of regional filtering, you'll find that members will choose their location to suit which flag they want to show. I've got one member from Bronx, NY Puerto Rico and another from Edison, NJ Bosnia. It's made searching for nearby members quite useless.<
Posted
Starting Member
Simko
Posts: 25
25
Does anyone have the flag mod to install on this version? I've searched in here and in archived posts but the links to download the mod in there are dead and for older versions only.

<
 
You Must enter a message