Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
  #1  
Old 11-07-2010, 12:21 AM
Mark.B Mark.B is offline
Senior Member
 
Join Date: Feb 2004
Posts: 1,354
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Problem trying to hook online users into search.

Here's what I'm trying to do:

http://www.bowlandcentral.com/forum/...hp?do=getdaily

As you can see, at the top of the getdaily search is a Who's Online block.

I did this a while ago, and basically I copied the Who's Online code from index.php (forumhome), hooked it into search_start, and then placed $activeusers inside some html in the template, and it works.

Can I make it work in vB4? Two solid days and nothing!!

I have done the same thing, copied the code (this time from forum.php obviously). It seems from tests that search_start no longer works as a hook, but search_process_start does. Anyway I've tested it extensively in both.

Code:
$templater = vB_Template::create('forumhome_loggedinuser');
$templater->register('loggedin', $loggedin);
$activeusers .= $templater->render();
By my reckoning, if I place {vb:raw activeusers} in the search_resultlist template, this should give me a raw list of logged in users, which I can then style.

However, the output is nothing...blank.No matter what I try to do.

Am I fundamentally misunderstanding something? It's rather vital I get this working and I am now completely flummoxed!

This piece of code has the following at the bottom to register the variables, which I am presuming is correct.....
Reply With Quote
  #2  
Old 11-07-2010, 03:04 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

$activeusers is literally just the list of active users. You could just use the template_hook there in search_resultlist. Use the hook location search_start and then try (at the end of your code you stole from forum.php):
Code:
$template_hook['search_results_top'] .= $activeusers;
And you'll get a list of active users. You'll have to pretty it up with <div>s and all.
Reply With Quote
  #3  
Old 11-07-2010, 08:15 AM
Mark.B Mark.B is offline
Senior Member
 
Join Date: Feb 2004
Posts: 1,354
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Lynne I have it now...thank you. I used the hook as you suggested.

Also hook location should have been where it originally was...search_start. I checked in the file and the hook is there. Why it didn't work originally I don't know.

Now for some galling CSS work to make it look nice.

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

Here's the results with styling.

http://www.bowlandcentral.com/images/shots2/shot12.jpg
Reply With Quote
  #4  
Old 11-07-2010, 02:27 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice, Mark! (I like your avatar in the upper right also - I don't think I've seen that yet in all the sites I've looked at!)
Reply With Quote
  #5  
Old 11-07-2010, 08:47 PM
Mark.B Mark.B is offline
Senior Member
 
Join Date: Feb 2004
Posts: 1,354
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
Nice, Mark! (I like your avatar in the upper right also - I don't think I've seen that yet in all the sites I've looked at!)
Thanks Lynne, the avatar is a mod on here that I tweaked a bit. I'm quite pelased with the results.

Am now having fun with tabs, with help from your article. I've spent most of the day on this but I have one tab that won't play ball, and it's because I'm trying to put a dropdown menu in the UPPER (main) tabs, rather than the sub menus. And I have a sneaky feeling that actually isn't going to work.....
Reply With Quote
  #6  
Old 11-07-2010, 08:54 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

There is an article on how to have the navtab as a dropdown. I thinks it's by shelby?
Reply With Quote
  #7  
Old 11-07-2010, 09:19 PM
Mark.B Mark.B is offline
Senior Member
 
Join Date: Feb 2004
Posts: 1,354
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
There is an article on how to have the navtab as a dropdown. I thinks it's by shelby?
Thanks, off to have a look before I drive myself bonkers.
Reply With Quote
  #8  
Old 11-08-2010, 09:48 AM
Retal Retal is offline
 
Join Date: Nov 2006
Posts: 58
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It's basically the same as in navbar

Navbar dropdown menu looks like this
HTML Code:
<li class="popupmenu"><a class="popupctrl">Dropdown title</a>
	<ul class="popupbody popuphover">
		<li>Dropdown item 1</li>
	</ul>
</li>
while a dropdown menu in the navtab looks like this
HTML Code:
<li class="popupmenu"><a class="popupctrl navtab">Dropdown title</a>
	<ul class="popupbody popuphover">
		<li>Dropdown item 1</li>
	</ul>
</li>
+ a bit of styling
Reply With Quote
  #9  
Old 11-08-2010, 11:02 AM
Mark.B Mark.B is offline
Senior Member
 
Join Date: Feb 2004
Posts: 1,354
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Cheers...have now managed to get a dropdown tab and it highlights properly and everything. Only thing I'm finding is that the sub-menu styling is a little messed up (the lower navbar links).

I shall post a thread separately about this, it's functional but looks untidy. I can only assume the Javascript is messing with it but I can't see why.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:33 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07183 seconds
  • Memory Usage 2,246KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (2)bbcode_html
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete