PDA

View Full Version : Country flag in viewlink and linkdisplay


Christoffer Bol
05-08-2006, 11: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:

Simon Gooffin
05-08-2006, 12:20 PM
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, 12:38 PM
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

Simon Gooffin
05-08-2006, 01:10 PM
yes, it's exactly what I mean

Christoffer Bol
05-08-2006, 02: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... ;)

Greg
05-08-2006, 04:04 PM
#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, 04:06 PM
the custom field are already made... just not picking up the flags... and displays it.

Greg
05-08-2006, 04:51 PM
I thought you had the free version?

Christoffer Bol
05-08-2006, 05: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?

Simon Gooffin
05-09-2006, 05: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, 12:09 PM
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, 06:04 PM
Maybe someone else can help me out? :)

Simon Gooffin
05-12-2006, 08: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