You are missing our premiere tool bar navigation system! Register and use it for FREE!

NukeCops  
•  Home •  Downloads •  Gallery •  Your Account •  Forums • 
Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
Modules
· Home
· FAQ
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· PHP-Nuke HOWTO
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 432 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here
How to add URLs longer than 100 characters in Downloads and Web Links

18.10.1. How to add URLs longer than 100 characters in Downloads and Web Links

Not always is the database the sole culprit when you stumble upon an arbitrary limitation of the functionality: constraints are, for some obscure design reason, also eagerly set in the code of PHP-Nuke itself. A typical example of this situation, is the limitation of the URL length in the Downloads and Web_Links modules to just 100 characters. To remove this constraint you need to make changes to the database tables and the programming code.

The database change consists of a MySQL command that changes the length of the relevant field. For the Downloads module, the relevant field is the "url" field in the nuke_downloads_downloads table, for the Web_Links module it is the "url" field in the nuke_links_links table. To change its length, type on the MySQL command line

alter table nuke_downloads_downloads modify url varchar(200);

for the Downloads module, and

alter table nuke_links_links modify url varchar(200);

for the Web_links module.

Tip Changing the length of database fields
 

If you don't feel comfortable with the MySQL command line, you can use a graphical user interface (GUI) for it, like phpMyAdmin (see Section 3.4). But you can also pack the above commands in a PHP program:

<?php
include_once("mainfile.php");
global $prefix, $dbi;
$result=sql_query("alter table nuke_downloads_downloads modify url varchar(200)", $dbi);
if (!$result) {
 print (mysql_error());
}
$result=sql_query("alter table nuke_links_links modify url varchar(200)", $dbi);
if (!$result) {
 print (mysql_error());
}
?>

Upload it to your web server in the PHP-Nuke root directory (the one where config.php and mainfile.php are also located) and point your browser to it. The script even takes care to print a descriptive error message (a good programming practice), if an error occurs.

But you are not done yet: for the length change to really take effect, you must change all relevant occurences of "maxlength" in the PHP code to reflect the new length of the field in the various HTML forms. This means searching not only the modules folder, but also the admin folder, for files related to the two modules and containing the string "maxlength".

  • For the Downloads module, those are:

    1. The modules/Downloads/index.php file:

      .""._FILEURL.": <input type=\"text\" name=\"url\" size=\"50\" 
      maxlength=\"100\" value=\"http://\"><br>";
      .""._URL.":<br><input type=\"text\" name=\"url\" value=\"$url\" size=\"50\"
      maxlength=\"100\"><br><br>" 
      
    2. The admin/modules/download.php file:

      .""._FILEURL.": <input type=\"text\" name=\"url\" value=\"$url\" size=\"50\"
      maxlength=\"100\">&nbsp;[ <a target=\"_blank\" href=\"$url\">"._CHECK."</a> ]<br>"
      .""._FILEURL.": <input type=\"text\" name=\"url\" size=\"50\" 
      maxlength=\"100\" value=\"http://\"><br>";
      .""._PAGEURL.": <input type=\"text\" name=\"url\" value=\"$url\" size=\"50\"
      maxlength=\"100\">&nbsp;[ <a href=\"$url\">"._CHECK."</a> ]<br>"
      
  • For the Web Links module, they are:

    1. The modules/Web_Links/index.php file:

      .""._PAGEURL.": <input type=\"text\" name=\"url\" size=\"50\" 
      maxlength=\"100\" value=\"http://\"><br>";
      .""._URL.":<br><input type=\"text\" name=\"url\" value=\"$url\" size=\"50\"
      maxlength=\"100\"><br><br>" 
      
    2. The admin/modules/links.php file:

      .""._PAGEURL.": <input type=\"text\" name=\"url\" value=\"$url\" size=\"50\"
      maxlength=\"100\">&nbsp;[ <a target=\"_blank\" href=\"$url\">"._VISIT."</a> ]<br>"
      .""._PAGEURL.": <input type=\"text\" name=\"url\" size=\"50\" 
      maxlength=\"100\" value=\"http://\"><br>";
      .""._PAGEURL.": <input type=\"text\" name=\"url\" value=\"$url\" size=\"50\"
      maxlength=\"100\">&nbsp;[ <a href=\"$url\">Visit</a> ]<br>"
      .""._PAGEURL.": <input type=\"text\" name=\"url\" value=\"$url\" size=\"50\"
      maxlength=\"100\">&nbsp;[ <a target=\"_blank\" href=\"$url\">"._VISIT."</a> ]<br>"
      
Tip Search for "maxlength" thoroughly!
 

If it still does not work, then you forgot to change "maxlength" somewhere - perhaps in a file under the admin folder. Search thoroughly!


Help us make a better PHP-Nuke HOWTO!

Want to contribute to this HOWTO? Have a suggestion or a solution to a problem that was not treated here? Post your comments on my PHP-Nuke Forum!

Chris Karakas, Maintainer PHP-Nuke HOWTO

Powered by TOGETHER TEAM srl ITALY http://www.togetherteam.it - DONDELEO E-COMMERCE http://www.DonDeLeo.com - TUTTISU E-COMMERCE http://www.tuttisu.it
Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.108 Seconds - 196 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::