Shout-out to Blake’s boss who got me some cool gear from my wishlist. As of this post there is still a bounty out for these sunglasses that I fell in love with, which are listed on my wishlist. If someone gets those for me from my wishlist, I will design, compile, and submit a Google Chrome App for their Pligg site for free. If you fulfill this bounty. Please make sure to leave me a note on the wishlist page. So I know how to get in touch with you.
And now on to today’s Widget Wednesday post.
Today we are going to break down the Panel Tools widget that comes with Pligg and show you what each files does in a hope that you will have a better understanding of how to create your own admin panel widgets.
First we start with the widget name. This is also the same name as the widget folder. In this case it’s /panel_tools/
If we open that folder we see the following files
- /templates/ folder
The index.html file is blank and only there to protect against people from accessing the folder index. The panel_tools_readme.html file contains the widget name, author, and description that you see in the Pligg admin panel under the widget management.
The init.php file is what is used to install the widget and defines some aspects about the widget such as
- The widgets title
- Does the widget have settings? 0 or 1
- Allow the widget the ability to shrink? 0 or 1
- Allow you to uninstall the widget directly from the widget itself? 0 or 1
- The widgets name
- The widgets description
- The widgets version number
Now lets take a look inside the /templates/ folder. Inside we see the following:
The index.html file just like I described above is there to block anyone from getting into the folder index.
The Widget.php is where the magic happens. This is where you can use php to do what you want. In this particular widget we notice a couple things inside this file. First is that it has what are called “hooks” at the beginning and at the end of the file. These are there to allow other modules to add content into the widget automatically without the need to modify the file. The other things listed in this file are links to perform certain actions such as
- Delete template cache
- Optimize Database
- Backup your site
The thing you’ll notice about all widgets is that they all have the same structure.
And inside the /templates/ folder there are always 2 files
I hope this give you a little more incite about how a admin widget is constructed
If You would like to get me a Christmas gift you can check out my wishlist.
Tune in Tomorrow