Author |
Topic ![Next Topic Next Topic](images/icon_go_right.gif) |
|
StudyManSteve
Starting Member
New Zealand
11 Posts |
Posted - 23 October 2005 : 08:55:22
|
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 [url='url']link text[/url] 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?
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< |
|
MarcelG
Retired Support Moderator
![](images/icon_star_bronze.gif) ![](images/icon_star_bronze.gif) ![](images/icon_star_bronze.gif) ![](images/icon_star_bronze.gif) ![](images/icon_star_bronze.gif)
Netherlands
2625 Posts |
Posted - 23 October 2005 : 13:51:05
|
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. < |
portfolio - linkshrinker - oxle - twitter |
Edited by - MarcelG on 23 October 2005 13:51:22 |
![Go to Top of Page Go to Top of Page](images/icon_go_up.gif) |
|
StudyManSteve
Starting Member
New Zealand
11 Posts |
Posted - 23 October 2005 : 19:33:47
|
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 ![](images/icon_smile_big.gif)
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)< |
![Go to Top of Page Go to Top of Page](images/icon_go_up.gif) |
|
Lagzdin
Starting Member
Russia
13 Posts |
Posted - 28 November 2005 : 04:23:23
|
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 |
Edited by - Lagzdin on 28 November 2005 05:18:13 |
![Go to Top of Page Go to Top of Page](images/icon_go_up.gif) |
|
StudyManSteve
Starting Member
New Zealand
11 Posts |
Posted - 06 December 2005 : 00:19:36
|
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.< |
![Go to Top of Page Go to Top of Page](images/icon_go_up.gif) |
|
-gary
Development Team Member
![](images/icon_star_bronze.gif) ![](images/icon_star_bronze.gif)
406 Posts |
Posted - 06 December 2005 : 11:30:25
|
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.< |
KawiForums.com
![](http://www.snitzhcd.com/stats/rank.asp?1) |
![Go to Top of Page Go to Top of Page](images/icon_go_up.gif) |
|
Simko
Starting Member
25 Posts |
Posted - 29 October 2006 : 05:13:37
|
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.
< |
Edited by - Simko on 15 September 2007 16:29:42 |
![Go to Top of Page Go to Top of Page](images/icon_go_up.gif) |
|
|
Topic ![Next Topic Next Topic](images/icon_go_right.gif) |
|