View Full Version : Country flag in viewlink and linkdisplay
Christoffer Bol
05-08-2006, 10:48 AM
Im running a link site with links from diffrent countries, and i really want a litle flag on each link i add in admin. Like a drop-down menu to choose the country on every link.
The flag would be nice to have before the link title :)
I hope anyone can help me out... Thanks! :rolleyes:
Vasily B.
05-08-2006, 11:20 AM
this is not easy to implement.
but I will try to give you the directions
#1. create additional dropdown field for your country with name="country"
#2. set suggest-link page only.
#3. add the following code to your link-display.tpl file
{if $link.country}
{$link.country}.gif
{/if}
Your flags icons should have gif extensions.
Christoffer Bol
05-08-2006, 11:38 AM
Thanks! =)
Im not sure how to do this first step, but is it working with this kind of dropdown?
<select name="country">
<option value="Swedish">swedish</option>
<option value="Danish">danish</option>
<option value="Norwegian">norwegian</option>
</select>
Thanks for all help!! :D
Vasily B.
05-08-2006, 12:10 PM
yes, it's exactly what I mean
Christoffer Bol
05-08-2006, 01:28 PM
Now i have added this into link-display.tpl:
{if $link.country}
../flags/{$link.country}.gif
{/if}
And this to suggest-link.php in admin:
<tr>
<td>Country:</td>
<td>
<select name="country">
<option value="swedish">swedish</option>
<option value="danish">danish</option>
<option value="norwegian">norwegian</option>
</select>
</td>
</tr>
And no flag appears, im sure im missing something... But i really need some help to this... ;)
#1. create additional dropdown field for your country with name="country"
Christoffer you'll need ProVersion to create "custom fields"
Christoffer Bol
05-08-2006, 03:06 PM
the custom field are already made... just not picking up the flags... and displays it.
I thought you had the free version?
Christoffer Bol
05-08-2006, 04:56 PM
Yes i got the free version, but i made the field by my self in suggest-link.php in admin. Like i said:
Now i have added this into link-display.tpl:
{if $link.country}
../flags/{$link.country}.gif
{/if}
And this to suggest-link.php in admin:
<tr>
<td>Country:</td>
<td>
<select name="country">
<option value="swedish">swedish</option>
<option value="danish">danish</option>
<option value="norwegian">norwegian</option>
</select>
</td>
</tr>
Anyway... Why isnt the flags displaying?
Vasily B.
05-09-2006, 04:56 AM
actually it's not enough to have just a field on your template page :)
you should modify your links table and add some code in your php files. Add the following field to your links table (in phpMyAdmin)
country VARCHAR 255
*** open suggest-link.php file ***
*** find the following code ***
$link['reciprocal'] = $tmp['reciprocal'];
*** add the following code after ***
$link['country'] = $_POST['country'];
*** save changes ***
Christoffer Bol
05-09-2006, 11:09 AM
Okey, thanks for helping Simon :)
Now its done... and the flags dont appear when i post a new link and choose a country :(
When its working, is there a way to get this option on edit link page too? So i dont need to add all the links again.
Can you help me out some more and get this to work? please :rolleyes:
Christoffer Bol
05-11-2006, 05:04 PM
Maybe someone else can help me out? :)
Vasily B.
05-12-2006, 07:42 AM
now you should check if they are written in your database. please check if you have country value for your newly submitted links
vBulletin® v3.7.0, Copyright ©2000-2013, Jelsoft Enterprises Ltd.