2 Mar 26, 2008 21:37
No, and there will never be
No, and there will never be
errr... I can actually imagine that there will someday be...
This will require super strong 'I'm the admin and I'm gonna jeopardize my own site' privileges though...
One cool use of this is that you can put some "hacks" into a PHP widget and you might be able to migrate them from one version to another.
quard, can you give an example of how you would use this? I mean where would you need to have the PHP code executed?
Well, I've been thinking on this kind of plugin as a way to integrate content using some code I have, can't find anything like this and would be very helpfull......
Been a while since I checked the site for help, but hey that what happens when you've been running b2 for a few years!
One of the reasons I wanted to run php as a widget/plugin was so that I could do things like run a php countdown timer on the sidebar. Instead of modifying my main php code, I'd love to run widgets like the php countdown timer so that when I wanted to do it, I could just click it on or off.
I know there's a countdown widget now, but I prefer the one I was using on my site.
You can either use a FreeHTML widget to do an iframe pointing to the script or you can very easily create a widget (plugin) with the script.
A FreePHP is a tremendous hazard for the security of your blog.
Show me the script and I'll show you how to do a widget.
Afwas: thanks! I really appreciate the help. Here's what I put in my index.main.php to get a countdown timer for days of Xmas Music Left in a year. I'd like to create a widget that allows in the settings to change:
Title of Countdown
Hrs Min sec mnth day fields
<h3 class="sideItemTitle">Days of Xmas Music Left:</h3><h1>
$target = mktime(0, 0, 0, 12, 26, 2009) ; // hrs, min, sec, mth, day, year,
$today = time () ;
$difference =($target-$today) ;
$days =(int) ($difference/86400) ;
Also, is it possible to add the bSideItem and div classes to the widget itself so the main.php will never have to be edited if I want to change the widget?
Look at that. A FreePHP widget would hardly help here. Especially if you set your alarms every few days. I will look into this asap.
Have a nice day
Thanks, you too!
The plugin is crude and basic but it does what you want. If you notice the title of the widget you'll see it's meant for another purpose. In other words it's meant for you to play with :p
Thanks, I'll try it out soon!
hey, there's a countdown plugin from edb..
As I said earlier, I know there's a countdown widget , but I prefer the php one I was using on my site.
With this plugin I want to show how easy it is to write a widget. That is, this code is commented in a way that someone with moderate knowledge of PHP and some time to investigate the program flow can write a widget on his own.
Secondly and not less important I want to warn for a FreePHP thingy. Whatever way you do that it has the internal risk of someone blowing your blog away. Of course that some one could do the same in various other ways, but making a FreePHP widget is like inviting hackers to test it to its limits.
As stated earlier, if you want a widget like this - a countdown thingy - you're far better off investing that little more time. The widget has a setting where you can add a new date. With a FreePHP solution you'd be hacking the code every now and again. You're able to easily maintain larger chunks of code. The plugin has direct access to all of the other blog code (variables, functions, classes, caches). And it's still relatively safe.
Afwas: thanks again, appreciate it. I will definitely play around with it!
Slightly Related: can I make multiple widgets from one plugin?
The thing I'm doing was a huge skintag that basically built the entire sidebar. I'd like to make it be individual widgets so that, depending on circumstances, I could choose these 5 but not those 4 sidebar bits. So I started thinking "damn now I gotta figure out how to make widgets again THEN figure out how to make multiple widgets if that is possible" and along comes a widget making example.
So does anyone know if I can make multiple widgets?
(Sorry for not even trying yet but holy cow the plugin itself just went over 100K and isn't even close to useful :( )