I've been trying to figure out how to rename files for custom themes. I have made a block which is supposed to create a static article at the top of my theme. It can be seen here (introduction area):

http://danielsportfolio.co.uk/drupal6/

I want to configure the html of this block so I need to make a new file but can't figure out the name of it. So far after reading Drupal 6 template suggestions I've tried the following:

block-system-2.tpl.php = blockWord-systemModule-blockid2.tpl.php. I don't know if the id is correct, got it from blocks page.

block-block-2.tpl.php = Aparently creating a block in the blocks screen uses the block module, so tried block.

I've put a print statement at the top of my new file so that it will print when I get the right name, so far no luck.

print "block 2 for introduction"; Is this the right format?

At the moment one of my problems is how do I know what is ok in a template? Is is print("hello world") or print "hello world"; or echo "hello world"; ?

Comments

ziobudda’s picture

Hi, install devel and devel_themer module so you can see function and template file name for all element's page.

Freelancer Senior Drupal Developer -- http://www.ziobuddalabs.it

Adamantus’s picture

Well that shows me which function to override in the case of a template override but will it tell me what filename to use for a custom template file? All I can see is "candidate template files" in the template module, which says node-page.tpl.php.

WorldFallz’s picture

candidate template files are the names of the files you can create for overrides. If it's telling you 'node-page.tpl.php' then you're inspecting a node of the 'page' content type.

mndonx’s picture

Hi Adamantus - I don't see a block on the page you have linked. Maybe you are trying a different method? If you have a block in there, there should be block markup in the HTML - the id of the div wrapping the block should be the same as what you would name your tpl file. So for instance the Powered by Drupal block on your page:

<div class="block block-system" id="block-system-0">
    <h2 class="title"></h2>
    <div class="content"><a href="http://drupal.org"><img src="/drupal6/misc/powered-blue-80x15.png" alt="Powered by Drupal, an open source content management system" title="Powered by Drupal, an open source content management system" width="80" height="15" /></a>
    </div>
</div>

That would be altered with a block-system-0.tpl.php template file.

Let me know if that clears it up. Always make sure to clear the site's cache when you add a tpl file.

Adamantus’s picture

Thanks for the help. I was meaning the introduction section, if I look at the code is says "node sticky". I think I added this as a page and then applied it to the left region but I think I made a mistake in thinking it was a block because it was listed on the blocks page! I've added a block now and called it introduction block. I set it to appear on all pages and dragged it to the left region on blocks page and saved. But it doesn't show up. I added some test content to the body to be sure it would.

Sorry for asking so many questions but I'm finding the learning curve pretty tough going.

mndonx’s picture

No problem - feel free to ask away!

Adamantus’s picture

I was being daft. I realised that I have a left side and right right to my layout (design wise). But in terms of Drupal regions I have "content" and a "right". So I was thinking of the left area as being equivalent to the "left" region when in fact it was "content". So the moral of the story is don't add stuff to regions that don't exist. Doh!