Creating a Yii 1.1 Blog App with like dislike option for posts - yii

Need full code guidance for creating a like dislike option for post in Yii 1.1 Blog Application, anyone?

Probably add a field, or two, to the post table. Add new action, or two, to the controller. Then add your links for up/down voting to the _view.php file, set to the new action(s). In the actions increment/decrement the new field(s).

Related

Shopify: How to add custom field to admin blog create page?

I am trying to add custom field like Video URL when creating a new blog in admin page.
How can I do that?
Finally, I found this one.
https://help.advancedcustomfield.com/
Very good one for adding custom fields to products, collections, blogs as well as posts.
Thanks to great app makers!

How to separate username and email on ASP.NET Core Identity

I'm so newbie in here as I try to learn this new stuff. But, I have a problem. On asp.net core identity, there's no AccountController (as many blog say it should be modified there), so how can I modify this? I'm so confused with this. Thank you.
The latest version of Identity has a default UI that's included programmatically, via AddDefaultIdentity (which calls AddDefaultUI under the hood). You can use the Identity scaffold to add just the parts you want to modify, which works like an overload: anything not explicitly included in your project falls back to the default UI version.
Right-click on your project in the Solution Explorer, go to "Add" and then "New Scaffolded Item..." On the left of the resulting window, there's a tab for "Identity", which has just one scaffold to choose from, "Identity". Click the "Add" button. This will get you yet another window, where you can now choose which items you want to scaffold into your project.
Be advised that Identity's default UI makes use of Razor Pages, now, so you still won't get an AccountController and such. However, you can simply include pages like Account\Register and Account\Login, which should be the two places you would need to make this change. Feel free to add and modify anything else you like as well.

Comment functionality on every page in Yii 1.1

I am using Yii 1.1.16 for one of my projects.
I have 5 controllers at the moment, and their data is coming from their respective models.
Now I want to add new functionality into my website, regarding comments. I want to add a form at the bottom of each view, but obviously the data will be coming from another database table (I have created a new model for that).
I am confused. Should I create 5 different forms in HTML for my problem, or can I use Yii widgets functionality to implement the same?
The Comment table would be the same for every user in the database. Comments will be coming with the help of their user id, which is stored in the table, and their comment will be inserted with the help of their user id, too.
Please let me know the best solution you can think of.
I suggest to create one widget for displaying comments section and one controller for handling request from this widget (for example adding new comment or displaying different page of comments list). In this way adding comments for any section should require only few lines of code to initialize widget:
$this->widget('CommentsWidget', [
'parentId' => 'page-' . $model->id,
]);

Get blog post custom field in template head - Sitefinity

I need to set several meta tag values in my page head to values set in blog post custom fields.
How do I access the blog item viewmodel from the head?
I've created a separate MVC view snippet for my custom head and referenced it in my template's layout, that much works.
Tried
I grab some of the same custom field values inside my blog template via references like Model.Item.Fields.MyFieldName.Fields.Title.
Adding this same line to the head template throws a
System.Web.HttpCompileException with little useful information attached. I somewhat expected this, as I suspect that viewmodel for the blog post only exists in the context of the blog widget.
Ends up that I need to rebuild after every change to the head cshtml file or I get this error. Seeing as this is about a four-minute process with Sitefinity (15 seconds to build, 3:45 to do whatever Sitefinity does for about four minutes), this is a gruelingly horrid thing to have to do.
However the Model is null at this level.
Also tried
Per the ever-helpful and highly knowledgeable #Veselin Vasilev, I looked into passing the data up via MetaDataFields. I didn't see these options in my admin section for the widget. To clarify, I'm using the built-in "Blog posts" widget with a customized view file.
But if it's possible to do this, it gives me hope that there's a way to pass more data up, even if it's going to take some work.
EDIT: Sitefinity v.10.2 and above:
There is an easier way to achieve what you are trying - in Page edit mode, in the Blog Posts widget click Edit and then Advanced. Then you should see a MetaDataFields button. Click it and you should see several meta data related fields.
In the MetaTitle field put the name of your custom field and save.
Also, from the docs:
If you leave MetaTitle field empty, Sitefinity CMS adds takes its value from the Title field of the static content item or from the identifier field of a dynamic content item. Otherwise, the tag is populated with the contents of the field that you have entered in MetaTitle field.
More details here:
https://docs.sitefinity.com/configure-meta-title-and-meta-description-on-widget-level
Sitefinity 10.1 and below:
Check this article
Basically, in your view you get a reference to the Page object and then update its Header with the meta data you need.

Yii - Create items list

is there a simple way of creating a list with editable elements (add/remove) on a page?
Something simillar to the users managing list, where you can add and delete users.
For example, you got a table in DB with 2 columns - "Name" and "Value", and rows like
"Onion"-"10" and "Potato"-"20". The idea is to display the table on a page and make it editable.
Sounds simple but im new in Yii, just yesterday learned about it, did first app and other stuff from guides, but there is no guide how to create things like that manually (so far i was installing widgets mostly)
Thanks
The component you need is CGridView. Take a look to this website.
Yii Playground