Posts

Showing posts from September, 2014

How to make a template file for your custom content type in Drupal 7

So far, all the sites I have made in Drupal (both of them hehe), have had numerous content types, and each node of that type needs to be displayed in it's own theme. By default, it seems, Drupal doesn't have this functionality built in, but luckily it's not hard to add. Let's say your content type is called "Products" - naturally you would want to name the page template for that content type something like page--products.tpl.php - but without the little hack below, that won't work. So, to get that to work, make sure you have a template.php file in the root folder of your theme, and then add this code to it: <?php      function nameofyourtheme _preprocess_page(&$vars)         {             if (isset($vars['node']->type))             {                 $vars['theme_hook_suggestions'][] = 'page__' . $vars['node']->type;     ...

How to remove line on top of a table in Drupal

This will just be a quick post. Drupal tends to add a gray line at the top of any <table> elements you may have on your page, even if you don't have a border specified. A quick and simple way of getting that annoying line gone is by adding this table {   border-collapse: separate !important; } to your stylesheet file. Does the trick for me!