Mecha CMS

Add extra functionality to the core engine.

Poll

Author: Taufik Nurrohman · 2065 Views

Tweet

Poll 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