Useful Code Snippets For Customizing Look & Navigation Of Drupal Websites
- You Can Reuse These By Simple Find/Replace: Forms API, Views, Custom Theming And Custom Module Development ***
I recently built a website called Pop Quiz Wiz. It is built in Drupal 6. It mostly uses Drupal Quiz Module.
While it was easy to have an up and running web site within a few minutes that was capable of creating quizzes and taking quizzes, there were a lot of changes that the client wished to incorporate within the site. I employed some code snippets that I found over the web, and wanted to share those with everyone – especially, the beginners and non coders, because these snippets were very simple to use (mostly, I had to modify ‘MYMODULE’ or ‘MYTHEME’ with some unique name).
In the presentation, I will build a part of the Quiz Site From Scratch, and demonstrate employment of some very useful code snippets that are highly reusable. They can be used for:
1. Creating your own subtheme. (I will use Pixture Reloaded as the Parent theme).
2. Modifying the look of your home page so that you really really get a BLANK page as background with no title.
3. Adding different Primary Links based on different Roles.
4. Adding a blurb to your ‘view’ (e.g. a list of quizzes) that was generated using Views Module.
5. Removing or repositioning some of the links on the node page (e.g. quiz node page)
6. Removing or repositioning some of the links in the node creation page (e.g. quiz node creation page)
I will finish the presentation with a quick demonstration of the finished popquizwiz site, and will answer any questions related to how I built any of the features on it.
The only PHP you need to know is:
1. <?php print $var; ?> is considered to be code and is equivalent of adding the text contained in the PHP variable called $var right there. For instance if the $var contained the text “This is awesome” … then you could either type “This is awesome” or type <?php print $var;?> …