I've just launched my new portfolio website.
Go visit it at davyvandenbremt.be.
I need to take a break now.
Some really interesting posts are coming up!
I've just launched my new portfolio website.
Go visit it at davyvandenbremt.be.
I need to take a break now.
Some really interesting posts are coming up!
A 'snippet' is "a programming term for a small region of re-usable source code or text", says Wikipedia. Of course there are a lot of snippets available for such a popular environment as Drupal.
In the Drupal handbook, the official documentation for Drupal, you can find two sections with snippets. One is for general PHP, SQL, view, block, ... snippets. The other is for theme snippets.
There are also two unofficial resources available, DrupalBin, a pastebin website for Drupal, and Drupal Snippets. The second one has few snippets available right now though. So the most dynamic resource to keep an eye on is DrupalBin.
There's probably a few more. I invite you to submit those in the comments.
By declaring a base href you can tell the browser that all relative links contained within the document start from that specified base location. This allows you to view how the related document will look and behave when placed on the server without actually having to do so. It also allows you to put your Drupal site in a subdirectory of your website.
Suppose you have a domain, www.yourdomain.com. You would like to put Drupal in a subdirectory called 'drupal-site'. Your homepage then would be http://www.yourdomain.com/drupal-site.
Now you have an about page, http://www.yourdomain.com/drupal-site/about/ and all your image are under http://www.yourdomain.com/drupal-site/images/. So if you would like to refer to an image in your about page you would have something like:
<img src="/images/myimage.jpg" />
The problem is the browser will interprete this as http://www.yourdomain.com/images/myimage.jpg.
In this case you would state the following tag in your html header:
<base href="http://www.yourdomain.com/drupal-site/" />
Drupal has its own way of working with this. In settings.php you have to put the global variable:
<?php $base_url = 'http://www.yourdomain.com/drupal-site/'; ?>
And in your page.tpl.php you print it:
<?php global $base_url; ?> <base href="<?php print $base_url ?>" />