• I have a custom view for nextGenGallery, in which i call the function “get_string_between”.

    If I perform a search that returns a page with this gallery view used, I get an error from Search Unleashed – presumibly becuase it is also trying to use the ‘get_string_between()’ function.

    Fatal error: Cannot redeclare get_string_between() (previously declared in …

    is there a way that I can wrap the call i make to this function somehow so that it does not get called if it is already in use?

    this is how it is called in my php:

    <?php
    		//Used to break down and extract the width and height of each image
    		function get_string_between($string, $start, $end){
    			$string = " ".$string;
    			$ini = strpos($string,$start);
    			if ($ini == 0) return "";
    			$ini += strlen($start);
    			$len = strpos($string,$end,$ini) - $ini;
    			return substr($string,$ini,$len);
    		}
    	?>

Viewing 1 replies (of 1 total)
  • Thread Starter gearu

    (@gearu)

    I eventually fixed this error by moving this function into my functions.php so that it didn’t get defined a second time. this solved the problem.

Viewing 1 replies (of 1 total)
  • The topic ‘Fatal error: Cannot redeclare get_string_between()’ is closed to new replies.