Creating a tpl.php file

UnderDesign - January 22, 2007 - 19:25
Project:Advanced Poll
Version:4.7.x-1.x-dev
Component:User interface (CSS, Images, etc.)
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Description

Love the advpoll module. I'm trying to retheme the way polls appear and have realised that I actually have no idea what the tpl.php file should be called. For some reason, it doesn't seem as simple as with, say, story.

I have tried:

node-advpoll.tpl.php
node-poll-binary.tpl.php
node-poll_binary.tpl.php
node-advpoll-binary.tpl.php

But none of these seem to work. Can someone point me in the right direction please?

Regards

Patrick

#1

fajerstarter - January 23, 2007 - 21:48

See for example http://drupal.org/node/11811. The forum should be helpfull as well.

The functions which are currently themable through template.php in advpoll (at least in 5.x-1.x-dev) are:

theme_advpoll_bar()
theme_advpoll_results()
theme_advpoll_voting_binary_form()
theme_advpoll_voting_ranking_form()

The source code is you best friend in this case.

#2

fajerstarter - January 23, 2007 - 21:50
Status:active» fixed

#3

ChrisKennedy - January 26, 2007 - 18:58

Also, let us know if there are ways to improve theming advpoll; I'm not sure that it has received much feedback from users. Although I highly recommend using the 5.0 version rather than 4.7.

#4

UnderDesign - January 26, 2007 - 19:21

Thanks for the feedback. Can someone please tell me what the .tpl.php file should be called?

#5

ChrisKennedy - January 26, 2007 - 20:26

The two types provided by advpoll are advpoll_binary and advpoll_ranking. I haven't done much theming so I defer to drupal's documentation, but I would suspect that the file should be named node-advpoll_binary.tpl.php.

#6

fajerstarter - January 26, 2007 - 21:39

Did you read the documentation I linked to? Do it again :) There is also some good examples in the comments on that page. What you do is that you either override the theme funtions (the one I listed) in a template.php file in your theme directory. The civicspace theme is a good example of this approach, look at the template.php file shipped with that theme.

...Or you use _phptemplate_callback() and point to a tpl.php file. The point there is that there is no default name, you name it yourself. The example at http://drupal.org/node/11811 uses this approach. Oh, and there is also a theming mailing list if you need more help on theming, this is not the best place for theming support, and this is not specific to advpoll at all. But, as Chris mentioned, if you do feel that the theming functions we provide could imporved, please create an issue here.

#7

UnderDesign - February 1, 2007 - 09:55

Right, I'm going to take a proper look at this today. I must confess that I've not read the comments above as thoroughly as I should - I've been in one of those "stupidly busy" places. But I'm going to get to the bottom of this now!

Thanks to everyone for responding and helping me out - even if I don't always get it first time, I always do appreciate the help I get :)

Regards

Patrick

#8

UnderDesign - February 1, 2007 - 10:47

OK, I've had a good look at the stuff that's here and I'm afraid I still don't entirely get it. My problem is this:

In both the teaser and the advanced block, the description field is included. I want to be able to remove this field and I want to be able to make the title appear differently, i.e., smaller. I know I could be completely wrong, but I cannot find a function anywhere that allows me to control this.

Is there a way to do this without hacking at the actual module code?

Regards

Patrick

#9

Anonymous - February 15, 2007 - 11:01
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.