I want to display the Content Vote form in a specific position of my joomla article, so I can't use the Content - Vote standard plugin because it's set to be displayed before the article body (I need something more flexible).

So I decided to take the form code from the Content - vote plugin and put them in my template com_content/article override .

Here is the code :

<?php $uri = JUri::getInstance();
$uri->setQuery($uri->getQuery() . '&hitcount=0');?>

<form method="post" action="<?php echo htmlspecialchars($uri->toString()); ?>" class="form-inline">
    <select name="user_rating">
        <option value="1">Vote 1</option>
        <option value="2">Vote 2</option>
        <option value="3">Vote 3</option>
        <option value="4">Vote 4</option>
        <option value="5" selected="selected">Vote 5</option>
    <input class="btn btn-primary" type="submit" name="submit_vote" value="Vote Now" />
    <input type="hidden" name="task" value="article.vote" />
    <input type="hidden" name="hitcount" value="0" />
    <input type="hidden" name="url" value="<?php echo htmlspecialchars($uri->toString()); ?>" />
    <?php echo JHtml::_('form.token') ?>

The code above is working good but my question, is it a good practice to embed that form directly to com_content override? Or do you have any other solution for a flexible Content - Vote function position for my article? Thanks

1 Answer 1


I think it would be better to just create another plugin based on Content - Vote. This one will just replace string in article for a form using some pseudo variables like {VOTEFORM}. Then you just add this {VOTEFORM} into a place in article where you want it to be. This will be update-safe cause no Template Overriding is required and default voting plugin will be intact. Of course you should disabled default plugin (Content - Vote) when using this one.


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.