Welcome Guest, Not a member yet? Register   Sign In
How to Create Widgets?
#1

[eluser]a.rishwan[/eluser]
Hi

I am fairly new to this forum. I just joined in today to be exact. But I have been using codeigniter for my projects and small hobby code crunching for almost an year now. And I am very pleased with how easy things have been so far.

I am currently developing a custom CMS for my employer.

Problem is, the dashboard, like as in Wordpress... requires widgets. So users have the control on which items they want on their dashboard. Again, just like in wordpress.

I have gone through various forums including this one. And the only promising one is the widget plugin somewhere here. Sorry I cannot find the link the post right now.

Even with that said plugin, it is not clear enough on how it used or applied.

So if someone could provide a clear cut walk-through of the plugin OR maybe a good tutorial on how this can be achieved with codeigniter would be great.

Many Thanks in Advance.
#2

[eluser]Phil Sturgeon[/eluser]
WP-style widgets can be pretty tough to implement. Take a look at how I did it in PyroCMS, you can probably scavenge a fair bit of code from there in the system/pyrocms/modules/widgets folder.
#3

[eluser]a.rishwan[/eluser]
Hi Phil

Thanks for the quick response. Your suggested PyroCMS is cool. And yes the widgets on the backend happens to load them preset. I thought of something like this too. But this is not what they need exactly. I'll jump into the code in a while and see what I can make out of it Smile

So I guess wordpress like widgets would be way too hard to achieve eh? ... what do you think about the widget plugin I mentioned?
#4

[eluser]Phil Sturgeon[/eluser]
Well as far as I know these are WP-style widgets. Widgets and Plugins are of course a massively vague concept, so explain more about what you are trying to do and I'll steer you in the right direction.
#5

[eluser]a.rishwan[/eluser]
Oh. I see. Thanks!

Well, the idea is... the backend is collaboration tool. Projects are created, users assigned to projects, and collaboration takes place within them. Pretty much like teambox and a bit of basecamp.

So every user has a dashboard as you would have already deduced that. Smile ... here, the user is supposed to see widgets like recent activity, calendars, to-do lists, files etc. The user has the ability to duplicated a widget and make the appear differently. Like a recent-activity widget can be loaded twice one showing recent activity for a single project and the other on another project.

I hope you understood what I said. Smile
#6

[eluser]Phil Sturgeon[/eluser]
Ok, so this is fairly similar to the Widgets base-code, your implementation is just a little different.

PyroCMS works around 3 tables.

widgets - details about the actual widgets available. RSS feed, Twitter stream, etc.
widget_instances - A specific instance of a widget contains specific data (rss URL or twitter username)
widget_area - Where will these widgets be going in the site?

You will need it to be a little different. You just assign a widget instance to a user instead of a widget area.

I suppose the "widget plugin" you're talking about wiredesignz's? It is fairly good, but you need much more implementation code and PyroCMS might steer you more in the right direction that you would with just his basic library.
#7

[eluser]a.rishwan[/eluser]
Hmm, I see how it is done now. I am going through the PyroCMS code right now. Its fairly straightforward Big Grin .. thank you very very much!..

Just one more question, I get it that I can achieve what I want by assigning an instance to a user. But I think I will also need them to assign them to an area. So that the second time a user is logging in, the widgets load back the very way the user left them. I guess I forgot to mention to you that the widgets require to be movable.

So I guess I will need the area table as well? right? that collates to each user?
#8

[eluser]Phil Sturgeon[/eluser]
Yep, that will be a combination of areas and an "order" integer. "dashboard_left" "dashboard_right" etc, then you can create other areas around the panel if needed.
#9

[eluser]a.rishwan[/eluser]
Thank you very much. This helps beyond imagination! ..

I will get back to you in a day or two once I am done experimenting them. Smile




Theme © iAndrew 2016 - Forum software by © MyBB