1

I need to display the number of visitors to a website on the homepage, and I'm wondering if there is a way to add formmating to the number output by the {hits} variable. http://ellislab.com/expressionengine/user-guide/templates/hit_counter.html

I've tried a few plugins, like "number-formatter" and even the "price-format" but I think the issue is that the {hits} won't parse from within some of these plugin tags.

Is there a better way to display (and format) the total number of visits to any one page on a site with EE?

THANKS!

Mike

1 Answer 1

1

This is probably due to parse order. {hits} isn't tag specific, so probably gets parsed later than the plugins you're using to format the value.

Try using track_views="one" parameter on the channel:entries tag you use to build the homepage (assuming you have an entry associated with the homepage), that will give you the equivalent of {hits}. Then use {view_count_one} in the template, which should get parsed prior to the plugin that formats it: Number formatter, Number Format, etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.