Issue with eval (1 post)

  1. zemq
    Posted 3 years ago #


    I have problem with parsing some piece of code in WP index and would like to ask yourself for help. I tried to solve it and was googling some kind of solution for last few days but with no result.

    So the issue is that I tried to create post pattern which uses custom fields through php commands. For parsing php code I use Exec-php plugin for WP.
    On my index, where you can find only first parts of posts, there is showing parsing error - look here. But on post itself there is no error and whole post is shown in a way it was supposed to be - look here. So the first strange conclusion is that the same code is interpreted in different way on index.php and on single.php. I changed themes twice, but error is still there.

    Here is 10 lines of post pattern code in which is (most likely) some error:

    1/ <div class="hlavicka">
    2/ <div class="head-vlevo">
    3/ <img class="uvodni" title="<?php echo get_post_meta(get_the_ID(), 'komplet', true);?>" src="<?php echo get_post_meta(get_the_ID(), 'imgurl', true);?><?php include (ABSPATH . 'php/str_komplet_img.php');?>.jpg" height="250px" alt="<?php echo get_post_meta(get_the_ID(), 'komplet', true);?>" />
    4/ </div>
    5/ <table class="tabulka">
    6/ <tbody>
    7/ <tr>
    8/ <td style="text-align:left; width:74%;">Nyní:</td>
    9/ <td style="text-align:right; width:25%; font-weight:bold;"><a href="<?php include (ABSPATH . 'php/url.php'); ?><?php include (ABSPATH . 'php/str_komplet.php'); ?><?php include (ABSPATH . 'php/html.php'); ?><?php include (ABSPATH . 'php/id.php'); ?>" target="_blank"><?php echo get_post_meta(get_the_ID(), 'akce', true); ?></a></td>
    10/ </tr>

    Error (according to what error message says) is on line 3, but I can see nothing wrong there. On the other hand if I delete line 3 then parsing is OK on single.php and also on index.php - no error in this case. In my opinion line 3 and 9 are very similar and are correct so I really don´t understand why line 3 is not interpreted the same way as line 9 is. Included file is also OK.

    Another file mentioned in error message is runtime.php from Exec-php plugin and here´s the part of it that is connected to error (specifically line 42):

    37/ function eval_php($content)
    38/	 {
    39/	 	 // to be compatible with older PHP4 installations
    40/		 // don't use fancy ob_XXX shortcut functions
    41/ 	 ob_start();
    42/	  eval (" ?> $content <?php " );
    43/ 	$output = ob_get_contents();
    44/		ob_end_clean();
    45/		return $output;
    46/	}

    There´s maybe something missing in that line (semi-colon, slash or whatever), because from that line the file stop colorize syntax when in editor. So I ask anybody who´s good at php to correct either my code on line 3, or runtime.php on line 42 or bring some other solution to solve my issue.


    [ Please refrain from bumping. ]

Topic Closed

This topic has been closed to new replies.

About this Topic