1
maru1
customizing Mylinks
  • 2006/4/7 8:52

  • maru1

  • Just popping in

  • Posts: 27

  • Since: 2006/3/28


I have XOOPS 2.0.13.2 with default Mylinks 1.1
I want to add a little flag to every link, thus showing the language of the site.
First I thought I could use the screenshoot feature for this purpose (as I don't want to make screenshoots). But I have also some multilanguage sites in my database. But I see no way to add more than one image. And the fact of being multilanguage is quite an important element of the sites I link to.
Next I tried to put an "img src" tag into the description of every link, but it doesn't work; just shows the link, not the image.

So my question is:
can I somehow add more than one image to link's description?
Or maybe I should move to another links module? If so, which one enables adding more images (if any)?

I'll be thankful for any suggestions!

2
McDonald
Re: customizing Mylinks
  • 2006/4/7 14:56

  • McDonald

  • Home away from home

  • Posts: 1072

  • Since: 2005/8/15


I've done something similar to WF-Links lately.
An extra dropdown menu has been added to the submit form and an extra row in the database. It's pretty simple. Now I can show with a little flag the country of origin of the link.
I'll have a look at MyLinks later and will tell you how to add this feature.

Resized Image

3
maru1
Re: customizing Mylinks
  • 2006/4/7 16:21

  • maru1

  • Just popping in

  • Posts: 27

  • Since: 2006/3/28


Yes, that's what I need!
Although I'd name this field "language" rather than "country", but that's a detail.
As I understand, you made it by yourself, editing the code?
So changing to WF-Links won't resolve my problem?

4
McDonald
Re: customizing Mylinks
  • 2006/4/7 16:29

  • McDonald

  • Home away from home

  • Posts: 1072

  • Since: 2005/8/15


This function is originally not implenented in WF-Links.
If you switch over to WF-Links it will make it much easier for me to tell you what and where in the code you have to make the changes.
WF-Links will change it's name into SmartLinks and will be available from the SmartFactory website in the near future.

5
McDonald
Re: customizing Mylinks
  • 2006/4/7 23:53

  • McDonald

  • Home away from home

  • Posts: 1072

  • Since: 2005/8/15


Resized ImageAdding country or language to WF-Links by small flag.

This will describe how you can add an option to WF-Links 1.03 for showing the country of origin or a sites language, see pictures.

It will add a drop-down menu with the countrylist to the submit form for users and admin panel for modification by the administrator.




Resized Image


The following files have to be modified:
1. include/functions.php
2. include/linkload.php
3. submit.php
4. admin/index.php
5. admin/modifications.php
6. language/english/admin.php & language/english/main.php
7. templates/wflinks_singlelink.html
8. templates/wflinks_linkloadsimple.html

Further, one extra line has to be added to the database table wflinks_links and the small flags has to be uploaded to your server.

WF-Links 1.03b can be downloaded here: http://members.lycos.nl/mcdonaldsstore/

Please note that changing any part of the code of WF-Links is at your own risk! Not mine!


[size=x-large]FIRST: MAKE A BACKUP OF YOUR DATABASE!!![/size]

Step 1.
Open the file include/functions.php in a text editor and add the following function at the end but before ?> :

function wfl_countryname($countryn)
{
     
$country_array = array ( ""   => "Unknown",
                              
"-"  => "Unknown",
                              
"AD" => "Andorra",
                              
"AE" => "United Arab Emirates",
                              
"AF" => "Afghanistan",
                              
"AG" => "Antigua And Barbuda",
                              
"AI" => "Anguilla",
                              
"AL" => "Albania",
                              
"AM" => "Armenia",
                              
"AN" => "Netherlands Antilles",
                              
"AO" => "Angola",
                              
"AQ" => "Antarctica",
                              
"AR" => "Argentina",
                              
"AS" => "American Samoa",
                              
"AT" => "Austria",
                              
"AU" => "Australia",
                              
"AW" => "Aruba",
                              
"AZ" => "Azerbaijan",
                              
"BA" => "Bosnia And Herzegovina",
                              
"BB" => "Barbados",
                              
"BD" => "Bangladesh",
                              
"BE" => "Belgium",
                              
"BG" => "Bulgaria",
                              
"BH" => "Bahrain",
                              
"BI" => "Burundi",
                              
"BJ" => "Benin",
                              
"BM" => "Bermuda",
                              
"BN" => "Brunei Darussalam",
                              
"BO" => "Bolivia",
                              
"BR" => "Brazil",
                              
"BS" => "Bahamas",
                              
"BT" => "Bhutan",
                              
"BW" => "Botswana",
                              
"BY" => "Belarus",
                              
"BZ" => "Belize",
                              
"CA" => "Canada",
                              
"CD" => "The Democratic Republic Of The Congo",
                              
"CF" => "Central African Republic",
                              
"CG" => "Congo",
                              
"CH" => "Switzerland",
                              
"CI" => "Cote D'Ivoire",
                              
"CK" => "Cook Islands",
                              
"CL" => "Chile",
                              
"CM" => "Cameroon",
                              
"CN" => "China",
                              
"CO" => "Colombia",
                              
"CR" => "Costa Rica",
                              
"CS" => "Serbia And Montenegro",
                              
"CU" => "Cuba",
                              
"CV" => "Cape Verde",
                              
"CY" => "Cyprus",
                              
"CZ" => "Czech Republic",
                              
"DE" => "Germany",
                              
"DJ" => "Djibouti",
                              
"DK" => "Denmark",
                              
"DM" => "Dominica",
                              
"DO" => "Dominican Republic",
                              
"DZ" => "Algeria",
                              
"EC" => "Ecuador",
                              
"EE" => "Estonia",
                              
"EG" => "Egypt",
                              
"ER" => "Eritrea",
                              
"ES" => "Spain",
                              
"ET" => "Ethiopia",
                              
"EU" => "Europe",
                              
"FI" => "Finland",
                              
"FJ" => "Fiji",
                              
"FK" => "Falkland Islands (Malvinas)",
                              
"FM" => "Federated States Of Micronesia",
                              
"FO" => "Faroe Islands",
                              
"FR" => "France",
                              
"GA" => "Gabon",
                              
"GB" => "United Kingdom",
                              
"GD" => "Grenada",
                              
"GE" => "Georgia",
                              
"GF" => "French Guiana",
                              
"GH" => "Ghana",
                              
"GI" => "Gibraltar",
                              
"GL" => "Greenland",
                              
"GM" => "Gambia",
                              
"GN" => "Guinea",
                              
"GP" => "Guadeloupe",
                              
"GQ" => "Equatorial Guinea",
                              
"GR" => "Greece",
                              
"GT" => "Guatemala",
                              
"GU" => "Guam",
                              
"GW" => "Guinea-Bissau",
                              
"GY" => "Guyana",
                              
"HK" => "Hong Kong",
                              
"HN" => "Honduras",
                              
"HR" => "Croatia",
                              
"HT" => "Haiti",
                              
"HU" => "Hungary",
                              
"ID" => "Indonesia",
                              
"IE" => "Ireland",
                              
"IL" => "Israel",
                              
"IN" => "India",
                              
"IO" => "British Indian Ocean Territory",
                              
"IQ" => "Iraq",
                              
"IR" => "Islamic Republic Of Iran",
                              
"IS" => "Iceland",
                              
"IT" => "Italy",
                              
"JM" => "Jamaica",
                              
"JO" => "Jordan",
                              
"JP" => "Japan",
                              
"KE" => "Kenya",
                              
"KG" => "Kyrgyzstan",
                              
"KH" => "Cambodia",
                              
"KI" => "Kiribati",
                              
"KM" => "Comoros",
                              
"KN" => "Saint Kitts And Nevis",
                              
"KR" => "Republic Of Korea",
                              
"KW" => "Kuwait",
                              
"KY" => "Cayman Islands",
                              
"KZ" => "Kazakhstan",
                              
"LA" => "Lao People'S Democratic Republic",
                              
"LB" => "Lebanon",
                              
"LC" => "Saint Lucia",
                              
"LI" => "Liechtenstein",
                              
"LK" => "Sri Lanka",
                              
"LR" => "Liberia",
                              
"LS" => "Lesotho",
                              
"LT" => "Lithuania",
                              
"LU" => "Luxembourg",
                              
"LV" => "Latvia",
                              
"LY" => "Libyan Arab Jamahiriya",
                              
"MA" => "Morocco",
                              
"MC" => "Monaco",
                              
"MD" => "Republic Of Moldova",
                              
"MG" => "Madagascar",
                              
"MH" => "Marshall Islands",
                              
"MK" => "The Former Yugoslav Republic Of Macedonia",
                              
"ML" => "Mali",
                              
"MM" => "Myanmar",
                              
"MN" => "Mongolia",
                              
"MO" => "Macao",
                              
"MP" => "Northern Mariana Islands",
                              
"MQ" => "Martinique",
                              
"MR" => "Mauritania",
                              
"MT" => "Malta",
                              
"MU" => "Mauritius",
                              
"MV" => "Maldives",
                              
"MW" => "Malawi",
                              
"MX" => "Mexico",
                              
"MY" => "Malaysia",
                              
"MZ" => "Mozambique",
                              
"NA" => "Namibia",
                              
"NC" => "New Caledonia",
                              
"NE" => "Niger",
                              
"NF" => "Norfolk Island",
                              
"NG" => "Nigeria",
                              
"NI" => "Nicaragua",
                              
"NL" => "Netherlands",
                              
"NO" => "Norway",
                              
"NP" => "Nepal",
                              
"NR" => "Nauru",
                              
"NU" => "Niue",
                              
"NZ" => "New Zealand",
                              
"OM" => "Oman",
                              
"PA" => "Panama",
                              
"PE" => "Peru",
                              
"PF" => "French Polynesia",
                              
"PG" => "Papua New Guinea",
                              
"PH" => "Philippines",
                              
"PK" => "Pakistan",
                              
"PL" => "Poland",
                              
"PR" => "Puerto Rico",
                              
"PS" => "Palestinian Territory, Occupied",
                              
"PT" => "Portugal",
                              
"PW" => "Palau",
                              
"PY" => "Paraguay",
                              
"QA" => "Qatar",
                              
"RE" => "Reunion",
                              
"RO" => "Romania",
                              
"RU" => "Russian Federation",
                              
"RW" => "Rwanda",
                              
"SA" => "Saudi Arabia",
                              
"SB" => "Solomon Islands",
                              
"SC" => "Seychelles",
                              
"SD" => "Sudan",
                              
"SE" => "Sweden",
                              
"SG" => "Singapore",
                              
"SI" => "Slovenia",
                              
"SK" => "Slovakia",
                              
"SL" => "Sierra Leone",
                              
"SM" => "San Marino",
                              
"SN" => "Senegal",
                              
"SO" => "Somalia",
                              
"SR" => "Suriname",
                              
"ST" => "Sao Tome And Principe",
                              
"SV" => "El Salvador",
                              
"SY" => "Syrian Arab Republic",
                              
"SZ" => "Swaziland",
                              
"TD" => "Chad",
                              
"TF" => "French Southern Territories",
                              
"TG" => "Togo",
                              
"TH" => "Thailand",
                              
"TJ" => "Tajikistan",
                              
"TK" => "Tokelau",
                              
"TL" => "Timor-Leste",
                              
"TM" => "Turkmenistan",
                              
"TN" => "Tunisia",
                              
"TO" => "Tonga",
                              
"TR" => "Turkey",
                              
"TT" => "Trinidad And Tobago",
                              
"TV" => "Tuvalu",
                              
"TW" => "Taiwan",
                              
"TZ" => "United Republic Of Tanzania",
                              
"UA" => "Ukraine",
                              
"UG" => "Uganda",
                              
"UK" => "United Kingdom",
                              
"US" => "United States",
                              
"UY" => "Uruguay",
                              
"UZ" => "Uzbekistan",
                              
"VA" => "Holy See (Vatican City State)",
                              
"VC" => "Saint Vincent And The Grenadines",
                              
"VE" => "Venezuela",
                              
"VG" => "Virgin Islands, British",
                              
"VI" => "Virgin Islands, U.S.",
                              
"VN" => "Viet Nam",
                              
"VU" => "Vanuatu",
                              
"WS" => "Samoa",
                              
"YE" => "Yemen",
                              
"YT" => "Mayotte",
                              
"ZA" => "South Africa",
                              
"ZM" => "Zambia",
                              
"ZW" => "Zimbabwe"
                              
);
     return 
$country_array[$countryn];
}



Step 2.
Open the file include/linkload.php in a text editor and add the following 3 blue lines to line 83 :

$link['publisher'] = ( isset( $link_arr['publisher'] ) && !empty( $link_arr['publisher'] ) ) ? $wfmyts -> htmlSpecialCharsStrip$link_arr['publisher'] ) : _MD_WFL_NOTSPECIFIED;

[
color=0000CC]$country=$link_arr['country'];
$link['country'] = XOOPS_URL "/uploads/flags/flags_ani/".$country.".gif";
$link['countryname'] = wfl_countryname$link_arr['country'] );[/color]

$link['mail_subject'] = rawurlencodesprintf_MD_WFL_INTFILEFOUND$xoopsConfig['sitename'] ) );


Step 3.
Open the file submit.form in a text editor and modify the following lines as mentioned:

Modify lines 62-63:
$sql "INSERT INTO " $xoopsDB -> prefixWFLINKS_LINKS ) . "    (lid, cid, title, url, submitter, status, date, hits, rating, votes, comments, forumid, published, expired, offline, description, ipaddress, notifypub, urlrating, country) ";
$sql .= " VALUES ('', $cid, '$title', '$url', '$submitter', '$status', '$date', 0, 0, 0, 0, '$forumid', '$publishdate', 0, '$offline', '$descriptionb', '$ipaddress', '$notifypub', '$urlrating', '$country')";


Modify line 110:
$sql "UPDATE " $xoopsDB -> prefixWFLINKS_LINKS ) . " SET cid=$cid, title='$title', url='$url', updated='$updated', offline='$offline', description='$descriptionb', ipaddress='$ipaddress', notifypub='$notifypub', urlrating='$urlrating', country='$country' WHERE lid =" $lid;


Modify lines 137-138:
$sql "INSERT INTO " $xoopsDB -> prefixWFLINKS_MOD ) . " (requestid, lid, cid, title, url, forumid, description, modifysubmitter, requestdate, country, keywords)";
$sql .= " VALUES ('', $lid$cid, '$title', '$url', '$forumid', '$descriptionb', '$urlrating' '$modifysubmitter', '$requestdate', '$country')";


Add this to line 206:
$country $link_array['country'] ? $wfmyts -> htmlSpecialCharsStrip$link_array['country'] ) : '-';


Add this line to line 225 after } but before ob_start():
$sform -> addElement( new XoopsFormSelectCountry_MD_WFL_COUNTRY'country'$country ), false);



Step 4.
Open the file admin/index.php in a editor and modify or add the following lines:

Add this to line 48:
$country $link_array['country'] ? $wfmyts -> htmlSpecialCharsStrip$link_array['country'] ) : '-';


Add this line between lines 104 and 105:
$sform -> addElement( new XoopsFormSelectCountry_AM_WFL_COUNTRY'country'$country ), false);


Modify lines 435-436:
$sql "INSERT INTO " $xoopsDB -> prefixWFLINKS_LINKS ) . " (lid, cid, title, url, screenshot, submitter, publisher, status, date, hits, rating, votes, comments, forumid, published, expired, updated, offline, description, ipaddress, notifypub, urlrating, country )";
$sql .= " VALUES ('', $cid, '$title', '$url', '$screenshot', '$submitter', '$publisher','$status', '$date', 0, 0, 0, 0, '$forumid', '$publishdate', 0, '$updated', '$offline', '$descriptionb', '$ipaddress', '0', '$urlrating', '$country')";



Step 5.
Open the file admin/modifications.php and modify as follows:

Modify line 26:
$sql "SELECT modifysubmitter, requestid, lid, cid, title, url, description, screenshot, forumid, urlrating, country FROM " $xoopsDB -> prefixWFLINKS_MOD ) . " WHERE requestid=" $requestid;


modify line 30:
$sql "SELECT submitter, lid, cid, title, url, description, screenshot, forumid, urlrating, country FROM " $xoopsDB -> prefixWFLINKS_LINKS ) . " WHERE lid=" $mod_array['lid'] ;


Add the next line between the lines 157 and 158:
$country $link_array['country'];


Modify line 161:
$xoopsDB -> query"UPDATE " $xoopsDB -> prefixWFLINKS_LINKS ) . " SET cid = $cid, title='$title', url='$url', submitter='$submitter', screenshot='$screenshot', publisher='$publisher', status='2', updated='$updated', description='$description', urlrating='$urlrating', country='$country' WHERE lid = " $lid );



Step 6.
Open the files language/english/admin.php and language/english/main.php in a text editor.

Add the following line at the end of language/english/admin.php:
define"_AM_WFL_COUNTRY""Country:" );


Add the following line at the end of language/english/main.php:
define"_MD_WFL_COUNTRY""Country:" );



Step 7.
Open the file templates/wflinks_singlelink.html in a text editor and add the blue line.
<div><small><{$link.hits|wordwrap:50:"n":true}>small>div>
[
color=0000CC]<div><small><b><{$smarty.const._MD_WFL_COUNTRY}b>&nbsp;>small><img src="<{$link.country}>" alt="<{$link.countryname}>" align="middle" />a>div>[/color]



Step 8.
Open the file templates/wflinks_linkloadsimple.html in a text editor and add the blue line.
<div><small><{$link.hits|wordwrap:50:"n":true}>small>div>
[
color=0000CC]<div><small><b><{$smarty.const._MD_WFL_COUNTRY}b>&nbsp;>small><img src="<{$link.country}>" alt="<{$link.countryname}>" align="middle" />a>div>[/color]



Step 9.
Create the following folder on your server: uploads/flags/flags_small/
Upload the little flags that can be downloaded from http://members.lycos.nl/mcdonaldsstore/ to the created folder.


Step 10.
Open your database table wflinks_links with phpMyAdmin and at the following row after urlrating:
name row: country
type : varchar
length : 5
null : not null
default : -


Do not forget to update the module once finished.


This hack is also available in MS Word format here: http://members.lycos.nl/mcdonaldsstore/


Good luck!

McDonald

6
maru1
Re: customizing Mylinks
  • 2006/4/9 7:48

  • maru1

  • Just popping in

  • Posts: 27

  • Since: 2006/3/28


Very good instructions, thank you.
I've even started Step 1, with changing names from countries to languages, and eliminating some of the flags (as for languages I don't need all of them), but then.. I've realized that I can't see if it allows a multiple choise from the drop-down menu. Does it?
Because that's what I am looking for: a way to display flags for all of the languages from a multilanguage site..

7
McDonald
Re: customizing Mylinks
  • 2006/4/9 7:54

  • McDonald

  • Home away from home

  • Posts: 1072

  • Since: 2005/8/15


This only works for one country or language, not for multiple languages.

8
technobia
Re: customizing Mylinks
  • 2006/4/29 17:18

  • technobia

  • Not too shy to talk

  • Posts: 122

  • Since: 2006/4/17


Hi McDonald,

I am looking to do something diffrent than what you have posted. I noticed that in your screen shot you have a keyword field in your mylinks submit form. I would like to add that the lates version of XOOPS Ihve installed (my first time using XOOPS) so my search function works more effectivly. I do not want to disply keywords in the links list to site visitors however, I just want the search function to search that field as well as the others.

Can you provide any direction or instructions on how to do this? I am not a PHP programmer but I can edit code alright. I have MyPhpAdmin that I am learning to use it as well for adding a new field to a table.

Thanks so much - Technobia
Thanks, Technobia
http://www.PrideDEPOT.com
Everybody Has A Right!

Login

Who's Online

344 user(s) are online (227 user(s) are browsing Support Forums)


Members: 0


Guests: 344


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits