where is the node.tpl.php file?

lasarletter - November 27, 2006 - 00:25

I am trying to follow the advice contained in this post (http://drupal.org/node/69545#comment-130459).

But I can't figure out where my node.tpl.php file is in my theme directory (UNIX).

Anybody know where it is (or the equivalent file for drupal 4.7.x) is?

thanks!

______________

Drupal tip #2: Sprinkling ads throughout your blog

Today's tip is simple, but potentially very useful to someone. One of the things you might notice if you visit some of the popular commercial blogs is that they sprinkle ads throughout their list of blog entries. For example, on your blog page, you might have a row of ads after the 2nd and 6th blog entries or something. Tweaking your ad placement is one sure way to increase your click-throughs. Doing this in Drupal is easy.

In your PHP Template theme, the node.tpl.php file controls the display of your nodes listing (e.g. node/ and blog/ pages). If we wanted to put an ad after the 2nd and 6th blog entries, we can put this code at the top of that file:

<?php
if ( !$page && ($id == 2 || $id == 6)) :
?>

[replace this comment with your ad code]
<?php
endif;
?>

The first part of the if statement (!$page) checks to make sure we're not looking at a single node page, e.g. node/view/1. The second part ($seqid = = 2 || $seqid = = 6) says to apply this code only to the 2nd and 6th entries on the page. Just change the numbers to wherever you want the ads to appear. Then drop your Ad code (e.g. from Google Adsense) in to replace the comment. To see what this looks like, check out the Weblog page on this site.

Do you actually have a PHPTemplate theme?

styro - November 27, 2006 - 00:56

If your theme is using another theme engine (eg xtemplate) or a pure PHP theme, then you won't have a node.tpl.php and won't be able to use one.

If your theme does use the PHPTemplate theme engine but it (unusually) doesn't have its own node.tpl.php file, you could always create one by copying it out of the PHPTemplate directory (themes/engines/phptemplate) and into your own themes directory.

--
Anton
New to Drupal? | Forum posting tips | Troubleshooting FAQ

The node.tpl.php file is in

syawillim - November 27, 2006 - 00:57

The node.tpl.php file is in your theme directoy - themes/yourtheme. That is if you are using phptemplate engine based theme.

www.drupalbasics.com | www.slickfish.com.au

You should see the

cog.rusty - November 27, 2006 - 00:58

You should see the 'node.tpl.php' file right there in your theme's main directory if you are using a theme based on the phptemplate engine.

If you are using an older theme engine then that tip does not apply. This is the case if you theme file name has a '.theme' extension.

 
 

Drupal is a registered trademark of Dries Buytaert.