Mecha CMS

Add extra functionality to the core engine.

Polls

Author: Taufik Nurrohman · 2023 Views

Tweet

Polls is a unified extension used to handle all tasks related to documenting the user’s input. Surely you’ve seen features such as like and reaction buttons on Facebook and on most portal websites, plus one on Google+, feedback on documentation/support websites. This extension brings them all together into a simpler yet more extensible system in a single folder.

Download Latest Version

Core 

<?php

Shield::get('poll', [
    'q' => 'Your Title', // optional
    'h' => 'Hints.', // optional
    'a' => [ // optional for `poll` with namespace(s)
        'key_1' => [
            'i' => '&#x2764;', // button text (usually an icon)
            'title' => 'Love this!' // button title (usually used to describe about the icon)
        ],
        'key_2' => [ … ],
        'key_3' => [ … ],
        …
        …
    ]
]);

?>

Usage 

Put this snippet in your page.php file to add a vote up/down feature on your page. Usually just before the </footer> tag:

<?php Shield::get('poll/vote'); ?>

Features 

Like 

1

Shield::get('poll/like');

Love 

2

Shield::get('poll/love');

Reaction 

3

Shield::get('poll/react');

Response 

4

Shield::get('poll/respond', [
    'q' => 'Was this article helpful?',
    'a' => ['Yes', 'No']
]);

Vote 

5

Shield::get('poll/vote');

Custom 

Shield::get('poll/respond', [
    'q' => 'Is throwing your hair in the garbage safe?',
    'h' => 'I wanted to be sure because in biology we learned that it had DNA and stuff so is it safe?',
    'a' => [
        'yes' => 'Yes it is.',
        'no' => 'No. I don’t think so.'
    ],
    'path' => 'my-poll' // path relative to `LOT` folder to store the polling data
]);

Dependency 

Extension 

3 Comments

  • Alexander Liebrecht

    Hi @tovic,

    Thanks for the brilliant extension and I now use it with Reactions. This looks good and so I can see for myself how the blog readers have found the topic.

    Simply very helpful.

    • Taufik Nurrohman

      Next time I will extend this extension to the comment extension so that users can like/dislike on any comments as well. Just like how Disqus works.

  • Alexander Liebrecht

    Thanks, Taufik! Look under https://mechacms.wpzweinull.ch/article/poll-umfragen-extension-fuers-mecha-v2-flat-file-cms-hier-live-im-einsatz

    I have explained to my German readers something, how they can integrate the user Reactions and handle. I think that a user who is dealing with Mecha v2, it can easily install it.