vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Possible to convert widget to forum block? (https://vborg.vbsupport.ru/showthread.php?t=244642)

wottech 06-15-2010 02:09 AM

Possible to convert widget to forum block?
 
Is there a way to convert a widget to a forum block, without a complete recode? I want a section navigation block in my forum that matches the one in the CMS. I have looked at the PHP file for the section navigation widget, as well as a CMS Articles block, and have made some attempts at getting the widget code to work as a block, but haven't had any luck at getting anything to display. Any thoughts or ideas would be greatly appreciated!

ArchAngelz 08-04-2010 02:34 PM

I'm having a similar requireemnt; how do we make a widget display as a forum block?

Videx 08-05-2010 01:09 AM

This should be a simple matter programmatically, but the problem right now is a lack of documentation. And the fact that little bits of code change with every update. But I have no doubt someone will figure it out eventually.

ArchAngelz 08-05-2010 02:21 AM

Oh, I always thought PHP is the same whether in a widget or forum block; but I'm not a programmer so I don't really know.

Would you be able to help me change the following from a php execution widget to a php forum block; this is my immediate need right now...

PHP Code:

$posts "Posts";
  
ob_start();
  require_once(
'./includes/functions_user.php');
  require_once(
'./includes/functions_bigthree.php');
  
// Current Week Top Posters
  
$starttime mktime(000date('n'), date('j'), date('Y')) - ((date('N')-1)*3600*24);
  
// Get Top Members for current week
  
$mostactiveweek_get vB::$db->query_read("
    SELECT "
.TABLE_PREFIX."user.userid, ".TABLE_PREFIX."user.username, ".TABLE_PREFIX."user.usertitle,
     COUNT("
.TABLE_PREFIX."post.postid) AS postcount
    FROM "
.TABLE_PREFIX."user
     LEFT JOIN "
.TABLE_PREFIX."post
      ON "
.TABLE_PREFIX."post.userid=".TABLE_PREFIX."user.userid
       AND dateline>'"
.$starttime."'
    WHERE usergroupid=2
   GROUP BY "
.TABLE_PREFIX."user.userid
   ORDER BY postcount DESC
   LIMIT 5"
);
  
$topposter true;
  
$output_bits '';
  while(
$user vB::$db->fetch_array($mostactiveweek_get))
  {
        
$percentage round(($user[postcount]/$totalposts[postcount]) * 100);
        if(
$topposter == true)
        {
           
$avatarurl fetch_avatar_url($user[userid]);
           if (!
$avatarurl) {
               
$useravatar 'images/misc/avatar.png';
           } else  {
              
$useravatar $avatarurl[0];
           }
           
$output_bits .='<div align="center">
                           <img border="0" src="'
.$useravatar.'"><br />
                           <a target="_blank" href="member.php?u='
.$user[userid].'">'.$user[username].'</a><br />
                           '
.$user[usertitle].'<br />
                           '
.$posts.':&nbsp;'.$user[postcount].'<br />
                           </div><hr />'
;
           
$topposter false;
        } else {
           
$output_bits .= '<a target="_blank" href="member.php?u='.$user[userid].'">'.$user[username].'</a><div style="float: right;">'.$user[postcount].'</div><br />';
        }
  } 

Quote:

Originally Posted by Videx (Post 2079425)
This should be a simple matter programmatically, but the problem right now is a lack of documentation. And the fact that little bits of code change with every update. But I have no doubt someone will figure it out eventually.


keithop 09-02-2010 07:15 PM

Quote:

Originally Posted by wottech (Post 2053811)
Is there a way to convert a widget to a forum block, without a complete recode? I want a section navigation block in my forum that matches the one in the CMS. I have looked at the PHP file for the section navigation widget, as well as a CMS Articles block, and have made some attempts at getting the widget code to work as a block, but haven't had any luck at getting anything to display. Any thoughts or ideas would be greatly appreciated!

Me too! I'd certainly be willing to pay for a conversion of the section/category navigation widgets or anything that would enable them to display on every forum page

Lynne 09-02-2010 09:41 PM

I have some code that I released as both a widget and a forum block. Download them both and compare the differences to see what you have to do.

wottech 09-02-2010 09:55 PM

Quote:

Originally Posted by Lynne (Post 2092999)
I have some code that I released as both a widget and a forum block. Download them both and compare the differences to see what you have to do.

Link? Or, at least a section in which you released it. Mods area, programming discussions, etc... Thanks!

--------------- Added [DATE]1283469206[/DATE] at [TIME]1283469206[/TIME] ---------------

Nevermind, I found them. Printing them out to compare, and then I'll take a look at the Section Navigation widget and see what I can do about creating a forum block out of it.


All times are GMT. The time now is 11:12 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01111 seconds
  • Memory Usage 1,752KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete