flattened Posted July 19, 2010 Share Posted July 19, 2010 I am in the process of integrating my current site into WordPress. Because I do a lot of hand coding I downloaded the Exec-PHP plugin. This is the current page I am moving : http://www.snookumz.com/you/graphics/swatches.php and here is the code: include("cookiecheck.php"); include("http://www.snookumz.com/top.php"); include($headervar.$skin.$extension); $sw= array(); require("swatch-list.php"); $count = count($sw); $per_page = 45; if (!isset($_GET['page']) || !is_numeric($_GET['page'])) { $page = 1; } $from = (($page * $per_page) - $per_page); $x=$from; $show = $from+$per_page; $total_results = $count; $total_pages = ceil($total_results / $per_page); echo "<div class='right'> Page "; for($x=1;$x<$page;$x++){ echo "<a href=\"?page=$x\">".$x."</a> "; } echo " <b>$page</b> "; for($x=($page+1);$x<=$total_pages;$x++){ echo "<a href=\"?page=$x\">".$x."</a> "; } echo "</div>"; echo "<div class='center'>"; while ($x<$show){ if($sw[$x])echo "$sw[$x] \n"; $x++; } echo "</div>"; echo "<div class='right'> Page "; for($x=1;$x<$page;$x++){ echo "<a href=\"?page=$x\">".$x."</a> "; } echo " <b>$page</b> "; for($x=($page+1);$x<=$total_pages;$x++){ echo "<a href=\"?page=$x\">".$x."</a> "; } echo "</div>"; include($footervar.$skin.$extension); The above code works perfectly. After stripping the header and footer tags, I have this left, and moved it to WordPress: $sw= array(); include("/URL/snookumz/you/graphics/swatch-list.php"); $count = count($sw); $per_page = 45; if (!isset($_GET['page']) || !is_numeric($_GET['page'])) { $page = 1; } $from = (($page * $per_page) - $per_page); $x=$from; $show = $from+$per_page; $total_results = $count; $total_pages = ceil($total_results / $per_page); echo "<div class='right'> Page "; for($x=1;$x<$page;$x++){ echo "<a href=\"&page=$x\">".$x."</a> "; } echo " <b>$page</b> "; for($x=($page+1);$x<=$total_pages;$x++){ echo "<a href=\"&page=$x\">".$x."</a> "; } echo "</div>"; echo "<div class='center'>"; while ($x<$show){ if($sw[$x])echo "$sw[$x] \n"; $x++; } echo "</div>"; echo "<div class='right'> Page "; for($x=1;$x<$page;$x++){ echo "<a href=\"&page=$x\">".$x."</a> "; } echo " <b>$page</b> "; for($x=($page+1);$x<=$total_pages;$x++){ echo "<a href=\"&page=$x\">".$x."</a> "; } echo "</div>"; But it returns the following error: Parse error: syntax error, unexpected ‘<' in /URL/snookumz/wordpress/wp-content/plugins/exec-php/includes/runtime.php(42) : eval()’d code on line 1 I went to the plugin's site and read everything so I know it's my code, but I don't know where. I'd be less confused if it didn't work the first time, but it just doesn't work on the WordPress page. Any help is greatly appreciated. :-\ Thank you. Link to comment https://forums.phpfreaks.com/topic/208138-previously-working-code-not-working-in-wordpress/ Share on other sites More sharing options...
xcandiottix Posted July 19, 2010 Share Posted July 19, 2010 try <?php on line one instead of <? maybe? Link to comment https://forums.phpfreaks.com/topic/208138-previously-working-code-not-working-in-wordpress/#findComment-1087986 Share on other sites More sharing options...
flattened Posted July 19, 2010 Author Share Posted July 19, 2010 I tried that on my code, but do you mean on the plugin file? Link to comment https://forums.phpfreaks.com/topic/208138-previously-working-code-not-working-in-wordpress/#findComment-1087989 Share on other sites More sharing options...
xcandiottix Posted July 19, 2010 Share Posted July 19, 2010 You modified your post, but before you did I saw line 1 was <? instead of <?php ... which some servers don't like.. it was just the first thing that jumped at me. Link to comment https://forums.phpfreaks.com/topic/208138-previously-working-code-not-working-in-wordpress/#findComment-1087992 Share on other sites More sharing options...
flattened Posted July 19, 2010 Author Share Posted July 19, 2010 Oh, I know want you mean. In the WordPress page, I did change it to <?PHP but it didn't change anything, it still didn't work. Link to comment https://forums.phpfreaks.com/topic/208138-previously-working-code-not-working-in-wordpress/#findComment-1088002 Share on other sites More sharing options...
timvdalen Posted July 19, 2010 Share Posted July 19, 2010 try not doing any <? at all. The plugin is trying to eval your code. It already knows it's code, so you don't have to include <? before it. What you're doing now is like this: <?php <?php [code] ?> ?> EDIT: wow, did you see how that screwed up the code and blocks? That's kinda what's happening on your pages. Link to comment https://forums.phpfreaks.com/topic/208138-previously-working-code-not-working-in-wordpress/#findComment-1088027 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.