WordPress.org

Ready to get started?Download WordPress

Forums

Search Unleashed
Fatal error: Cannot redeclare get_string_between() (2 posts)

  1. gearu
    Member
    Posted 2 years ago #

    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);
    		}
    	?>
  2. gearu
    Member
    Posted 2 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic