PDA

View Full Version : Can you use CMS Widgets as sidebar blocks??


addamroy
06-02-2012, 08:21 PM
I'm just wondering if we can use the code provided for the various CMS widgets available in the mods section, within sidebar blocks for the standard forum sidebar.

There's pretty much no sidebar specific widgets I can find here, they're all CMS widgets according to their category, not sure if these will work in the sidebar, I figured I'd ask first so I don't start executing bad PHP on the board.

Thanks!

kh99
06-02-2012, 08:34 PM
If you can find the code for a "php direct execution" cms widget, I believe in many cases you can use that code directly in a "custom html/php" forum block. One minor difference is that php code for a widget assigns it's html to a $output variable while a forum block needs to return the html as a string, but you should be able to take cms widget code and add "return $output;" as the last line and achieve the same thing.

There may be other problems with accessing variables like $vbulletin, but they should be easy to fix.

addamroy
06-02-2012, 09:33 PM
Awesome thanks, I'm going to give that a shot that helps alot.