Isn't it more comfortable being able to choose the image for your review (if you are an administrator) from a dropdown list that offers the names of all available modules/PHP-Nuke_HOWTO/images in your image directory,
rather than having to enter the full URL to the image each time? You could easily incorporate this functionality if you just cut and pasted the code from the admin/modules/topics.php file. The
functionality is in the Topics module already - you don't need to write full URLs to the topics icons, do you?
The relevant part in the Reviews to introduce the code from the Topics module is the following code in modules/Reviews/index.php:
if(is_admin($admin)) { echo " <b>"._RIMAGEFILE.":</b><br> <input type=\"text\" name=\"cover\" size=\"40\" maxlength=\"100\"><br> <i>"._RIMAGEFILEREQ."</i><br><br> "; } Replace it with: if(is_admin($admin)) { echo " <b>"._RIMAGEFILE.":</b><br> echo "<select name="cover">"; $path1 = explode ("/", "modules/PHP-Nuke_HOWTO/images/reviews/"); $path = "$path1[0]/$path1[1]"; $handle=opendir($path); while ($file = readdir($handle)) { if ( (ereg("^([_0-9a-zA-Z]+)([.]{1})([_0-9a-zA-Z]{3})$",$file)) AND $file != "AllTopics.gif") { $tlist .= "$file "; } } closedir($handle); $tlist = explode(" ", $tlist); sort($tlist); for ($i=0; $i < sizeof($tlist); $i++) { if($tlist[$i]!="") { if ($topicimage == $tlist[$i]) { $sel = "selected"; } else { $sel = ""; } echo "<option name="cover" value="$tlist[$i]" $sel>$tlist[$i]n"; } } echo "</select><br>"; echo "<i>"._RIMAGEFILEREQ."</i><br><br> "; } |
The part of code that was stolen from the Topics module (from the admin/modules/topics.php file) is between the blank lines in the above code. It will offer you a dropdown list of all modules/PHP-Nuke_HOWTO/images in the modules/PHP-Nuke_HOWTO/images/reviews folder. Just like with the topics modules/PHP-Nuke_HOWTO/images, you must use all small letters and no underscores or other special characters. See choose image for review.
Prev | Home | Next |
How to allow only registered users to enter a review | Up | Modifying the PHP-Nuke Web_Links module |
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 |