lpxxfaintxx Posted March 16, 2006 Share Posted March 16, 2006 First question: How can you show the folder before, for example: "/upload/lpxxfaintxx/category2" NOT just "category2".[code]<?phpfunction this_folder_name($path){ if (!$path){$path=$_SERVER['PHP_SELF'];} $current_directory = dirname($path); $current_directory = str_replace('\\','/',$current_directory); $current_directory = explode('/',$current_directory); $current_directory = end($current_directory); return $current_directory;}print this_folder_name();?>[/code][/quote]Question 2:Warning: Missing argument 1 for this_folder_name(), called in C:\wamp\www\aimphotogallery\ownmod\foldername.php on line 17 and defined in C:\wamp\www\aimphotogallery\ownmod\foldername.php on line 9ownmod[/quote]The script works, but the error keeps on popping up. Its starting to bug me, is there any solution? Link to comment https://forums.phpfreaks.com/topic/5110-missing-argument/ Share on other sites More sharing options...
ToonMariner Posted March 16, 2006 Share Posted March 16, 2006 Yes..You have declared the function with a parameter. That means when you want to call that function you must pass a parameter to it.iefunction urfunc ($param) {...return $string;}print urfunc(); // this will fail as you have no parameter.print urfunc('word_or_var'); // this will work as there is a parameter being passed.If you don't want to pass a parameter you can define default values for parameters so that passing them is not neccessary.function urfunc ($param = 'default_val') {...return $string;} Link to comment https://forums.phpfreaks.com/topic/5110-missing-argument/#findComment-18135 Share on other sites More sharing options...
lpxxfaintxx Posted March 16, 2006 Author Share Posted March 16, 2006 Thanks. Link to comment https://forums.phpfreaks.com/topic/5110-missing-argument/#findComment-18137 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.