Short: Is it possible to use PHP to include Drupal functions in a block? What if I want to show $primary_links within a block for instance? I admit I'm new to PHP and Drupal.
Long: I want to create multiple header blocks for a theme. This may not be the best way to do this but what I'm wanting is to make it easier for the user to use multiple headers. I thought the best way to make it easy on them was to create the headers as blocks and show them how to change the header by picking a different block. I want to call different css files for each header and that's easy enough. But I've also decided to include a navbar within the header that includes $primary_links. The problem is I can't figure out how use PHP to call the $primary_links in a block.
Comments
Well...
Hmmm... it only took me thirty seconds or so after posting to realize that I could just use page.tpl.php to code the header and then since I can call a css file in the block I can just style each header that way. But I still would really like to know if it's possible to call functions from the Drupal api into a block. I'm guessing (again I know very little about PHP) that you would use PHP include to pull it off but I'm not sure how to make it work.
Has anyone ever tried this? Is it possible? Is there any reason to do so even? I have so many questions. =)
You can enable PHP filter in
You can enable PHP filter in Modules and then code directly into the block body field.
The more Drupal way might be to write your own simple module which creates a block with hook_block and include your php in it. This will allow you to upgrade without accidentally overwriting your data :)