Can someone please explain what this code means?

Start a buffer and exit PHP mode. Use short tags. Keep that stuff off it’s own files (MVC design pattern).

The major problem with HEREDOCs is it breaks up indents.

No. The data from the vote is being saved server side so you have to generate the bars server side with php.

Is it easier to do it using Javascript, because that was mentioned somewhere else in the script? I know some basic php only from PHP and MySQL for dummies, but enough to make code that does everything except the image part (I think). Is that easy to do in PHP or should I be using Javascript instead? Here’s the link to a poll that should be designed the same way as the last one from the same site (I just couldn’t find the exact one.): http://polls.j-14.com/polls/185163

Last time I checked LI’s are block level Alex. They certainly behave as such when no CSS is applied to them. Also note the following.

As for the w3c’s docs themselves, no particular tag is labeled as being block level or inline. This might be due to the fact that css can change the element’s display style from block to inline or back as I’m sure you are aware.

For myself I consider “block” level those element that behave as blocks if you don’t style them otherwise. I’m fairly certain that’s a common approach.

Further divs inside li’s have validated through every validation parser I’ve tested them against. Remember that several CSS only menu systems depend on this layout approach using this trick

li div { display: none; }
li:hover div { display: block; }

EDIT: Forgot about the list-item display style and that it was the default. Hadn’t used it in years.

Polarbear4646: Any PHP which is used should be within the source code provided by the place which gives the statistics, if none is provided within the stuff you copy and paste then it will have already executed at the server side (as mentioned above) and therefore won’t be relevant to what you’re doing. :slight_smile:

An element with ‘display: list-item’ generates a principal box for the element’s content and an optional marker box as a visual indication that the element is a list item.

SJH: In the specification it states that the principle box being generated is to act as a visual indicator (giving the appearance that it’s a list item when it’s not). It does not change the semantic nature of the content, nor does it give any justification to say that using that CSS will override the HTML’s block level status. What you are quoting is simply a statement saying that using it will achieve the visual effect to make it appear as intended, it does in no way counteract the previous mentions within the specification which state that inline elements should not contain block level ones. Sorry but such usage is still incorrect, and it’s still semantically poor code.

Sorry but IMO that’s like claiming you can use a table inside a list on the basis that you can apply display: inline; to it. So we’ll agree to disagree in this case. :slight_smile:

Not true; an <li> tag has the display property list-item, which behaves exactly like a block element with a bullet in front of it. So a nested <div> is perfectly valid.

Apart from the fact that the code is (as stated) HTML and CSS, not PHP, the content of the code itself is very poorly produced (DIV elements within LI’s is illegal syntax as you can’t have block level elements within an inline element). You either need to post the complete code you have (in the case of PHP which we won’t see in your sites code) or link us to the page (if it’s JavaScript powered or uses just HTML and CSS) so we can further examine what you are using. Other than that I would consider trying a simpler solution which doesn’t require you to have any HTML or CSS knowledge like Polldaddy if you’re still confused. :slight_smile: