Inline PHP If/Elseif/Else statement Help
-
Hello, I am attempting to use your plugin to inject some PHP/HTML coding into a page on our WP site but I am running into the following error when trying to view the page:
Notice: Undefined index: err in /var/www/html/wp-content/plugins/insert-php/includes/shortcodes.php(66) : eval()’d code on line 1
Fatal error: Uncaught Error: Call to undefined function IsEmpty() in /var/www/html/wp-content/plugins/insert-php/includes/shortcodes.php(66) : eval()’d code:3 Stack trace: #0 /var/www/html/wp-content/plugins/insert-php/includes/shortcodes.php(66): eval() #1 /var/www/html/wp-content/plugins/insert-php/libs/factory/shortcodes/shortcode.class.php(287): WINP_SnippetShortcode->html(Array, ”) #2 /var/www/html/wp-content/plugins/insert-php/libs/factory/shortcodes/shortcodes.php(97): Wbcr_FactoryShortcodes324_Shortcode->render(Array, ”) #3 /var/www/html/wp-includes/shortcodes.php(319): Wbcr_FactoryShortcodes324_ShortcodeManager->__call(‘shortcode_WINP_…’, Array) #4 [internal function]: do_shortcode_tag(Array) #5 /var/www/html/wp-includes/shortcodes.php(197): preg_replace_callback(‘/\\[(\\[?)(wbcr_p…’, ‘do_shortcode_ta…’, ‘<style type=”te…’) #6 /var/www/html/wp-content/plugins/js_composer_theme/include/helpers/helpers.php(236): do_shortcode(‘<style type=”te…’) #7 /var/www/html/wp-content/plugins/js_composer_theme/inclu in /var/www/html/wp-content/plugins/insert-php/includes/shortcodes.php(66) : eval()’d code on line 3
Have you created the parser to handle inline php if-ing correctly? Here is my snippet:
if ($_GET['err'] === "LoginErr") : ?> <label style="display: block; font-size: 18px; font-weight: bold;">Username or password incorrect, or the username was not found. Please try again or ask for assistance.</label> <?php elseif (!IsEmpty($_GET['err'])) : ?> <label style="display: block; font-size: 18px; font-weight: bold;">An unexpected error has happened. Please notify the instructor.<br/><br/> Error Message: <?php echo $_GET['err']; ?></label> <?php else : ?> <?php endif;If I drop this into a non-Wordpress page and add in the first opening and last closing tags it works.
The topic ‘Inline PHP If/Elseif/Else statement Help’ is closed to new replies.