Want to alter poll display in subsilver2-based style

All style (template, theme and imageset) related questions for the new release; advice, feedback here please.
Post Reply
Registered User
Posts: 3
Joined: Wed Dec 01, 2010 7:51 pm

Want to alter poll display in subsilver2-based style

Post by Velaxi »


I want to alter a few things re: poll display in a template based on subsilver2. I looked at the Prosilver, and it's much more more complex than what I want to do.

I want to keep the basic format of what is displaying -- which is to say, Left Poll image, stretched center poll image, right poll image.
I did add a condition so that if poll pct = 0 not to display the center or right, as well as changing the template to left-align that cell.

What I would like to do (3 things, actually):
1. I would like to sort by vote count, instead of vote option id. So if there are 3 options and their votes are 2,0,1 respectively, it will display in the order of 1,3,2.

2. I would also like to set a percent value based on comparison to whichever has the most votes; i.e. from pt.1, the numbers would come out 100%, 50%, 0%.

I feel dense today (again :P)... if I could get pt.1 taken care of, pt.2 should be simple enough...

Can someone help me please?

Also: item 3 --
-- in IE7 the center poll image is gaining transparency from left to right (so it's 100% opacity at the left and transparent at the right, gradient).
How can I eliminate that?

Registered User
Posts: 3
Joined: Wed Dec 01, 2010 7:51 pm

Re: Want to alter poll display in subsilver2-based style

Post by Velaxi »

Alrighty well, I managed to get my sorting the way I wanted it.
Item 1 - Check.
(found the last DB access and inserted SORT BY po.poll_option_total DESC, po.poll_option_id)

I also managed to get my vote image span into a % value (dynamic with page) and get the poll options going to 100% for the majority vote, scaling down.
Item 2 - check.
(set the containing table to width75%, then set the values for all other column widths inside the table in the template. Then changed the return in the foreach call from px to %. Also added a loop to check which value was highest vote count and replace if >, to use for the % determination, before the parsing of the poll options for display. Probably would have been tidyer to just do a max() call, but I couldn't get that to work).

Item 3 - Not sure. The wife updated her IE to v8, so I can't see the v7 issues anymore. Oh well, no big deal.

Other items:
Make it %val instead of PX val - check.
Make it all left-align instead of center - check.

Now I have a different issue, and this one is a little bit bigger, since I'm not comfortable yet with php (still learning).

I want to make the images for poll_center and poll_right load a different image based on an increment.

I have saved images called 0_poll_center.png*12*1 (et cetera) and I would like to insert the integer into the image call.
Can anyone explain to me how to do this? The relevant call is to:
$user->img('poll_center', altvalue, widthvalue)

I can't find where that is defined in the functions, which makes inserting an option to be concatenated with the actual filename difficult.

Any help?

Post Reply