How do I put a php include statement in the Left Block using the Administration menu? Is this possible or do I need to hard code the include statement in the Nuke code?
I want to insert a php file in an table in the left block of my nuke site, so that it will pull headlines from other sites and display them in nuke
The problem is: currently nuke understands html only in block contents. It would be very useful to get the possibility of using php code inside the blocks (in your case - include). I've written to the nuke author about it, however I haven't got a reply.
Nevertheless, the solution is simple and straightforward. Look at mainfile.php3, especially at mainblock, leftblocks and rightblocks functions. You'll see php nl2br() function is used to change textarea newlines into html <br> tags there before displaying the content using echo(). So, the nuke code allows html inside blocks. But you want php code there. Therefore change your mainfile.php3 and simply use eval($content); instead $content=nl2br($content); echo($content). All your block php code string will be evaluated and executed. I tried it and it works. In case of doubt check http://www.php.net/manual/function.eval.php .
The drawback of this is: after proposed modification only php code in blocks is allowed. I suppose it's not a problem: you can output html via php.
The more advanced solution could be to have an additional field in *block* database table defining if block contains html or php code. This field could be checked in mainfile.php3, which in turn could display pure html (via echo) or evaluate php string code (via eval).
Although the idea is correct, you have to change echo "$content"; to eval($content); in .../themes/Default/header.php3 (not in mainfile.php3) for instance.
Sorry for the confusion :-(
Thank you for the tips and howto's. To overcome the problem of the blocks only reading the php code , I created another MySQL table call phpblock, then in the header.php file, I copied the code that queries and displays the leftblock, using this code, I changed it to use the table phpblock instead of the left block (lblocks).
Now when, I want to include php into a block I just use the phpblock table. I still need to add the option to edit the phpblock in the Administration but for a quick fix, I think it will work fine. If there is a better way to do this, please let me know.
Thank you for your help.