How to fix "undefined index: regexp code on line 1"

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mariaz
    New Member
    • Mar 2008
    • 11

    How to fix "undefined index: regexp code on line 1"

    Hello, I am getting a Notice error on my website that says:
    Notice: Undefined index: _created_format ted in C:\EasyPHP1-8\www\eP\compon ents\com_jamboo k\jxtemplate.ph p(125) : regexp code on line 1

    but I don't know what it means..I have no index _created_format ted on my php page and I can't find my mistake..Can someone help me with this?Which part of my code should I see for mistakes, and what kind of mistakes might these be?When I used to run my site on my local server, there was no problem, once I inserted it online, it created this Notice error. Thank you in advance for your time!
  • rpnew
    New Member
    • Aug 2007
    • 189

    #2
    Originally posted by mariaz
    Hello, I am getting a Notice error on my website that says:
    Notice: Undefined index: _created_format ted in C:\EasyPHP1-8\www\eP\compon ents\com_jamboo k\jxtemplate.ph p(125) : regexp code on line 1

    but I don't know what it means..I have no index _created_format ted on my php page and I can't find my mistake..Can someone help me with this?Which part of my code should I see for mistakes, and what kind of mistakes might these be?When I used to run my site on my local server, there was no problem, once I inserted it online, it created this Notice error. Thank you in advance for your time!
    Hi,
    Can you post your page code snap here..

    Regards,
    RP

    Comment

    • ronverdonk
      Recognized Expert Specialist
      • Jul 2006
      • 4259

      #3
      All it means is that the named index key does not exist. But note that is is just a notice, not an error! Your script will survive and won't crash. But is it, of course, a nuisance. Are you certain that you do not have or do not call or execute a script with that name defined?
      If not, then the error is most likely in a script that you use from 3rd party software, like you have.

      When not any of the above, show some code. And do it within the appropriate code tags according to the Posting Guidelines.

      Ronald

      Comment

      • mariaz
        New Member
        • Mar 2008
        • 11

        #4
        I think the mistake must be in this function, it is the last function of the php file:

        Code:
        function parseTemplate( $variables="", $tmpl="" ) {
        		if ( $tmpl ) {
        			$this->setTemplate( $tmpl );
        		}
        		if ( $variables ) {
        			$this->setVars( $variables );
        		}
        		if ( isset( $this->content ) ) {
        			// Replace all variable values
        			$this->patterns['jxtvalue'] = "/{jxtvalue=([^}]*)}/ie";
        			$this->replacements['jxtvalue'] = "\$this->vars['\\1']";
        			// In addition to variables we will also replace any language strings found.
        			$this->patterns['jxtlang'] = "/{jxtlang=([^}]*)}/ie";
        			$this->replacements['jxtlang'] = "constant('\\1')";
        			// Show blocks only if a given variable has a value
        			$this->patterns['jxtshowif'] = "#{jxtshowif=([^}]*)}(.*){/jxtshowif}#Usie";
        			$this->replacements['jxtshowif'] = "(\$this->vars['\\1']) ? stripslashes('\\2') : ''";
        			// Show blocks if a given variable is empty
        			$this->patterns['jxtshowifnot'] = "#{jxtshowifnot=([^}]*)}(.*){/jxtshowifnot}#Usie";
        			$this->replacements['jxtshowifnot'] = "(\$this->vars['\\1']) ? '' : stripslashes('\\2')";
        			$this->output = preg_replace( $this->patterns, $this->replacements, $this->content );
        			return true;
        		} else {
        			return false;
        		}
        	}
        The notice error points to the line that begins with "$this->output=..." but I don't know what that error may be..

        Comment

        • satas
          New Member
          • Nov 2007
          • 82

          #5
          Originally posted by mariaz
          When I used to run my site on my local server, there was no problem, once I inserted it online, it created this Notice error. Thank you in advance for your time!
          It means that error_reporting option in your local php.ini file does not allow to output notices.

          Add this 2 lines in your script and you will see the same notice on localhost:
          [PHP]ini_set('displa y_errors',1);
          error_reporting (E_ALL);[/PHP]

          The simpliest solution is to add @ operator in your script:
          [PHP]@$this->output = preg_replace( $this->patterns, $this->replacements , $this->content );[/PHP]

          But note - adding a lot of @ operators is not a good programming style.

          Comment

          Working...