Creating a Custom Drupal Block With PHP
The main goal I had was to add a list of forums to the left sidebar of The Central America Forum, a website I implemented when I lived in Costa Rica. I wanted to do this for SEO so that my content is not buried so deeply but can be reached more easily by search engines and users from the front page. (I've already got a block for anonymous users in the very last part of the page to load, the right block, with the all-time most popular pages; that's good, of course, but it leaves the less-popular pages buried.)
It's not hard to create a custom block, but all the steps have to be in place.
Here is the basic roadmap: http://drupal.org/node/246986
But because I'm running drupal 6, the PHP input format is not enabled by default - it has to be enabled by enabling an additional module. So go to admin/build/modules and enable:
|6.8||Allows embedded PHP code/snippets to be evaluated.|
Set the permissions properly for that the input format (the default it is not even enabled for moderator; you must enable for moderator if you have a moderator user class like I do and intend the user to insert the php; do NOT enable PHP for any users other than moderator because it is a huge security hole).
Easy enough. Now back to the roadmap, create the block (I set visible for moderator only for testing), enable it on the left side, insert the php code, and specify the input format to be PHP. Works fine. After I've finished customizing it the way I like it, I'll enable it for registered and anonymous users and make some further additions to this blog.