Custom Templates
Here is a list of some custom templates you can do instead of using QARR built-in templates.
To use custom templates create a folder called qarr
inside your templates
directory.
Sample Templates
Look inside qarr/templates/frontend/custom
for templates. So copy over what you need and configure.
File Extension
You can use html
or twig
extension
Display Rating
To display ratings you can use
{{ craft.qarr.displayRating(model, true) }}
Second param is optional, if set to false
the function will return object rather than html markup.
Example: {% set rating = craft.qarr.displayRating(model, false) %}
setting this to false
will return an object
array[
"averageRating" => 3.888888889,
"total" => "54"
]
Template
Checks templates/qarr/rating.twig
directory first, then fallsback to qarr/frontend/custom/rating.twig
.
Attributes
averageRating
- Average rating number out of 5 stars.total
- Total number of approved reviews
Display Reviews
To display reviews you can use
{{ craft.qarr.displayReviews(model, true) }}
Second param is optional, if set to false
the function will return object rather than html markup.
Example: {% set reviews = craft.qarr.displayReviews(model, false) %}
setting this to false
will return an object
array[
"averageRating" => 3.888888889,
"reviews" => array[...],
"total" => "54"
]
Template
Checks templates/qarr/reviews.twig
directory first, then fallsback to qarr/frontend/custom/reviews.twig
.
Attributes
reviews
- Array ofqarr\elements\Review
elementstotal
- Total number of approved reviews
Replies
review.reply
- Gets reply for review itemreply.author
- Get author of replyreply.dateCreated
- Reply date
Display Questions
To display questions you can use
{{ craft.qarr.displayQuestions(model, true) }}
Second param is optional, if set to false
the function will return object rather than html markup.
Example: {% set questions = craft.qarr.displayQuestions(model, false) %}
setting this to false
will return an object
array[
"questions" => array[...],
"total" => "54"
]
Template
Checks templates/qarr/questions.twig
directory first, then fallsback to qarr/frontend/custom/questions.twig
.
Attributes
questions
- Array ofqarr\elements\Question
elementstotal
- Total number of approved questions
Answers
question.answers
- Array ofqarr\model\Answer
models for specific questionanswer
- Returns answer stringanonymous
- Checks if user requested to be posted anonymouslyauthor
- Gets author objectcraft\elements\User
abuse
- Check is answer has been marked as abusivedateCreated
- Answer date