I have a database like:
I want to display the rating of the question.
The column Rating
is int contain the rating point from each user.
How can I display this int value as a rating star?
Please help me - how do I start my controller and view?
CodePudding user response:
You can achieve this using JQuery plugin , so you pass the value you want to the view as usual , the same way you pass all the model data , after that , The Jquery plugin is gonna take care of displaying that value in form of stars . all you have to do is including the Jquery plugin in your scripts and follow the documentation on how to use it. For that purpose , I advise you to use the RateYo plugin , you find here all the required info about it and how to use it . For mopre options , you may refer to this link to choose a different plugin
CodePudding user response:
- You need to add a new controller
- Add a new View
- Add a model to hold the value "Rating"
- look into how to get your connection string and connect to your database
- Initialise the model in your new controller
- populate the model with the value from the database
- return the model to the view
go step by step and research each bit