User login
4.x
Drupal Howto: Adding a nifty metadata box to your nodes
Submitted by peach on Tue, 01/08/2008 - 14:12.In this tutorial, we will be adding a container with metadata about your node to our node template. To see what I mean, look at the bottom of this node page. Code snippet is plug-and-play, so you can plug it right into your custom theme, or one of my own Drupal themes.
The box in question can contain any node information we want, such as link information, to ensure the blogosphere can link to us effortlessly, or statistical data about our node (hits etc.).
For starters, we're going to add a simple container to our node that contains a html link, a BBcode link, and the trackback url of our node. Open up your node.tpl.php file, and add a new div element at the end:
Drupal Adsense Trick #2: adblocks between teasers
Submitted by peach on Fri, 01/04/2008 - 13:10.This article is the sequel to my first drupal adsense article. This time we're going to put adsense blocks in between teasers, on for example our frontpage. Same as last time, this does not require any modules, nor does it depend on adsense, it works with any phptemplate-based theme and with all sorts of ad code.
For starters, we're going to create a new block region. If there is not a template.php file in your theme folder, create one and open it up. See if there is a block regions function, if there is, add a new block to it: 'betwteasers' => t('between teasers')
If you didn't find a block region function copy this code into your template.php file (this code should be in between <?php and ?> tags):
function yourtheme_regions() {
return array(
'right' => t('right sidebar'),
'left' => t('left sidebar'),
'content' => t('content'),
'header' => t('header'),
'footer' => t('footer'),
'subnav' => t('subnav'),
'betwteasers' => t('between teasers'),
);
}
Automagically placing adsense inside content
Submitted by peach on Sat, 11/17/2007 - 21:16.This is my first ever blog post, so I'm going to keep it simple, and start with this easy trick to add adsense to your articles. This trick does not require the usage of the adsense module, or any other module. Actually, this trick does not even require adsense, because in essence, we'll be creating an in-content block in wich you can put any type of advertising you like.
First of all, we're going to create a new block region. Put the following code in your template.php file, if you don't have one, create a template.php file and put it in the directory of your theme:
function yourtheme_regions() {
return array(
'right' => t('right sidebar'),
'left' => t('left sidebar'),
'content' => t('content'),
'header' => t('header'),
'footer' => t('footer'),
'incontent' => t('in content')
);
}
