In this section we modify the PHP-Nuke Downloads module:
How to add URLs longer than 100 characters in Downloads and Web Links (Section 18.10.1).
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.
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:
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:
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>" |
The admin/modules/download.php file:
.""._FILEURL.": <input type=\"text\" name=\"url\" value=\"$url\" size=\"50\" maxlength=\"100\"> [ <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\"> [ <a href=\"$url\">"._CHECK."</a> ]<br>" |
For the Web Links module, they are:
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>" |
The admin/modules/links.php file:
.""._PAGEURL.": <input type=\"text\" name=\"url\" value=\"$url\" size=\"50\" maxlength=\"100\"> [ <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\"> [ <a href=\"$url\">Visit</a> ]<br>" .""._PAGEURL.": <input type=\"text\" name=\"url\" value=\"$url\" size=\"50\" maxlength=\"100\"> [ <a target=\"_blank\" href=\"$url\">"._VISIT."</a> ]<br>" |
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! |