axtg86 Posted April 5, 2009 Share Posted April 5, 2009 Hi all, It has been one of those days. Looking at two lines of code all day, not being able to solve the issue. Here is what I'd like to do. Let's say I have three pages (simplified example). content.php <? echo "hello world"; ?> fillcontent.php function getContent($page) { $filestream = @fopen("./content/".$page.".php", "r"); $filecontent = @fread($filestream, @filesize("./content/".$page.".php")); $brace_o = "("; // Convert to eval() friendly character $brace_c = ")"; $semi = ";"; $ques="?"; $php_open="<${ques}php"; $php_close="${ques}>"; eval("$php_closestrtoupper${brace_o}$filecontent${brace_c}${semi}$php_open"); // = eval("?>strtoupper($filecontent);<?"); // I'm closing php tag first, because $filecontent already contains these (prevent repetition) } index.php <? getContent('content'); ?> But this throws me the following error: Parse error: parse error in ../fillcontent.php(109) : eval()'d code on line 1 I have no clue what is causing this. So any new directions are much appreciated! For those curious (might help): I'd like to include user generated pages (which might include PHP) into a template file and instead of the strtoupper() mentioned above I'd like to include a markdown() function. Making it possible for users to use Wiki mark-up (== header ==). Best regards! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.