Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 12-24-2010, 01:22 PM
Yonatan Yonatan is offline
 
Join Date: Jun 2008
Posts: 46
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Get CMS Section via Plugin

Hello!

I had some issue at version 4.0.3 that I can't get the section ID.
It's been discussed already:
http://www.vbulletin.com/forum/showt...in-plugin-code
https://vborg.vbsupport.ru/showpost....&postcount=238
(and the next replies..)

and vBulletin developers also said that they will provide fix in 4.0.4+ version:
http://www.vbulletin.com/forum/showt...=1#post1967245

But now I'm using in version 4.1.0 PL2 in the code:
PHP Code:
global $sectionid;
$sectionid $this->content->getParentId();

if (
$sectionid == 3)  
{
    
$vbulletin->options['selectednavtab']='content.php?r=3';
    
$tabselected ' class="selected"';
    
$tablinks '';


and it's not working!

Anyone have some solution to that issue?

Thanks!
Reply With Quote
  #2  
Old 12-24-2010, 03:44 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What hook location? Also, why not just use $_GET['r']?
Reply With Quote
  #3  
Old 12-24-2010, 04:39 PM
Yonatan Yonatan is offline
 
Join Date: Jun 2008
Posts: 46
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
What hook location? Also, why not just use $_GET['r']?
1) process_templates_complete.
2) Because those 2 issue's:
Reply With Quote
  #4  
Old 12-24-2010, 05:27 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What are you expecting to happen from your plugin? All you've done is set some variables.... what are you going to do with them? That isn't going to make a navtab at all. So what is the expected result?

Getting the parentid works just fine if you use the hook location vbcms_content_populate_end. If you use vbcms_section_populate_end, then you will get the parentid of that section which is probably 1. But again, exactly what are you trying to do?
Reply With Quote
  #5  
Old 12-25-2010, 09:06 AM
Yonatan Yonatan is offline
 
Join Date: Jun 2008
Posts: 46
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
What are you expecting to happen from your plugin? All you've done is set some variables.... what are you going to do with them? That isn't going to make a navtab at all. So what is the expected result?

Getting the parentid works just fine if you use the hook location vbcms_content_populate_end. If you use vbcms_section_populate_end, then you will get the parentid of that section which is probably 1. But again, exactly what are you trying to do?
I'm expecting from this plugin to behavior like any other default tabs - so if I'm on this tab, the Home tab will unselected and if I'm viewing in some article that related to this section id, this tab will highlighted.
Reply With Quote
  #6  
Old 12-25-2010, 06:27 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You've done nothing in that plugin to insert a navtab into your navbar. You need to use a template_hook to insert it. Something like:

PHP Code:
$template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href="link.php">Nav Link</a>'.$tablinks.'</li>' 
You probably need to make $template_hook global also. And, you'll have to do something to the Home navtab plugin to not make it selected also since it is currently set to be the active tab is you are on a content page (you'll have to change the condition to be "on content page except these content pages....").
Reply With Quote
  #7  
Old 12-25-2010, 07:57 PM
Yonatan Yonatan is offline
 
Join Date: Jun 2008
Posts: 46
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
You've done nothing in that plugin to insert a navtab into your navbar. You need to use a template_hook to insert it. Something like:

PHP Code:
$template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href="link.php">Nav Link</a>'.$tablinks.'</li>' 
You probably need to make $template_hook global also. And, you'll have to do something to the Home navtab plugin to not make it selected also since it is currently set to be the active tab is you are on a content page (you'll have to change the condition to be "on content page except these content pages....").
Of course I have more lines in that plug in(I just put the ones who related to this issue).

This is my whole code:
PHP Code:
$tabselected '';
$tablinks '';

if ((
$_GET['r'] == 3) && (THIS_SCRIPT == 'vbcms'))  
{
    
$vbulletin->options['selectednavtab']='content.php?r=3';
    
$tabselected ' class="selected"';
    
$tablinks '';

}

$template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href="content.php?r=3">Tab Name</a>'.$tablinks.'</li>' 
And I didn't actually understood what you meant after that, can you explain me that again with some examples?

Thanks!
Reply With Quote
  #8  
Old 12-25-2010, 08:53 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The variable, $template_hook, probably needs to be globalized (it did when I put the code into a plugin using the hook location vbcms_content_populate_end), or you will get no output.
Reply With Quote
  #9  
Old 05-30-2011, 09:44 PM
Yonatan Yonatan is offline
 
Join Date: Jun 2008
Posts: 46
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
The variable, $template_hook, probably needs to be globalized (it did when I put the code into a plugin using the hook location vbcms_content_populate_end), or you will get no output.
Sorry for jumping this thread.

I've been searching for working code but I didn't find anything.

Can anyone give me some example for working code?

Thanks!
Reply With Quote
Reply


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 09:14 AM.


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.03899 seconds
  • Memory Usage 2,257KB
  • Queries Executed 11 (?)
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
  • (4)bbcode_php
  • (4)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_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