NZ Web Hosting - Articles about website development

Drupal - Display Content on Front Page Only


You may want to display a block of content only on the front page of your Drupal powered website. A fairly simple thing to do just select the "Show on only the listed pages" box and put <front> into "Pages:" section.

Yes that will show the block on the front page, but it will also show the block on all of the paginated pages as well.

If you don't want the block to show on the paginated pages you can do the following:

Display Ads Between Posts in Drupal


You have probably noticed that many websites tend to display advertising between posts, surrounded by relevant content.

Achieving this in Drupal is a trivial task. All you need to do is place the following code to the top of the node.tpl.php for whatever theme you are running.

If you are using custom_content and customizing it differently using a node-custom_content.tpl.php, don't forget to add the code to the node-custom_content.tpl.php as well.

<?php if ( !$page && ($id == 2 || $id == 4)) : ?>adsense code goes here<?php endif; ?>

Firefox CSS Trick


You may have noticed that Firefox outlines hyperlinks when you click on them. Personally I find this a little bit annoying, especially when the hyperlink happens to be an image or a website logo.

However, as a web developer you can easily change this behavior for your website.

Just add this little piece of CSS to the main CSS file for your website to remove the outline:

Display Content for a Specific Role - Drupal


Sometimes, is can be a requirement to only allowed a specific group of users to view some content on a page. I'm not talking about showing or hiding the entire page to a specific role.

What I am talking about is that an authenticated user sees some different or additional content than an anonymous user will see on the same page.

I recently had a requirement to do just this on a community website that I am building. I needed to show a discount Coupon Code to registered users but not to anonymous users.

Drupal Text-Link-Ads & RSS Feeds


Regardless of whether the big "G" approves or not text-link-ads are still a very popular form of revenue for a lot of webmasters. From personal experience I have managed websites with text-link-ads that outperform Adsense with over ten times the revenue per month (this is even after the page rank penalties imposed in the last round of updates).

If you have a Drupal powered website and are still using text-link-ads you my want to consider modifying the code in the module. You may have noticed that at the end of each article in the feed the word Advertisement: is inserted. But, the Drupal module does not currently support text-link advertising in the RSS feed.

Syndicate content