Hi all,

Quick question

I have two style sheets style.css and reset.css on my D7 site.

They work fine.

I WANT TO ADD EXTERNAL STYLE SHEET SO PUT INTO TEMPLATE

      function tommysnewsite_preprocess_html(&$variables) {
        drupal_add_css('http://fonts.googleapis.com/css?family=PT+Sans+Narrow:regular,bold', array('type' => 'external'));
      }
     

When I cleared cache and reloaded the page is just blank! Nothing ...

WHAT HAVE I DONE WRONG???

Comments

nevets’s picture

You might try using the Google Fonts module.

Anonymous’s picture

Hi thanks for that, I didn't know about it.

I would like to know why the code doesn't work on the template.php file. It is the code for D7; however, it just stops the page loading and only shows a white screen when I insert this code into the template.php file ...

Many thanks nevets!

T.

gjangelo’s picture

in your development/ staging environments, put this in your settings.php file.....

ini_set('display_errors', 1);

No more WSOD, you'll get the filename & line number where the error occurred.

Anonymous’s picture

Thanks Lrrr,

I did this and it tells me:

Parse error: syntax error, unexpected T_STRING in /Applications/MAMP/htdocs/mysite/sites/all/themes/mysite/template.php on line 3

this would be

1 <?php
2
3 function mysite_preprocess_html(&$variables) {
4       drupal_add_css('http://fonts.googleapis.com/css?family=PT+Sans+Narrow:regular,bold', array('type' => 'external'));
5     }

gjangelo’s picture

Start deleting parts of the code so that the error disappears and the site loads. Put pieces of code back until it breaks. Then you've found your troublesome code!

I'm guessing that google URL might need to be encoded(?)