Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
  #1  
Old 06-13-2010, 06:25 PM
mordor1 mordor1 is offline
 
Join Date: Apr 2010
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How to export php code to vbulletin?

Dear Vbulletin users,

I did read this
https://vborg.vbsupport.ru/showthread.php?t=228928

And this
https://vborg.vbsupport.ru/showthread.php?t=217569

But nothing works All i want to do is that this code works

<?php $userfuncties->showMenu (); ?>

Why does it have to be so complicated for a simple task? Scripts works fine when its not in vbulletin...
Reply With Quote
  #2  
Old 06-14-2010, 05:42 PM
bleavitt bleavitt is offline
 
Join Date: Jun 2010
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hey Mordor1,

I just conclude a thread where I was running into a similar issue. I was a little frazzled that PHP functions wouldn't work in the templates either in v4.0. This has worked for me and it's not that much more complicated.

https://vborg.vbsupport.ru/showthread.php?t=243896

basically, in your specific template file (for example: 'header'), you create a new variable:

HTML Code:
{vb:raw show_menu}
where "show_menu" is the variable. Then down in the plugins/products menu, click on plugin manager, create a new plugin, set its hook to init_startup, and then add a bit of code that looks something like this (I've not tested this, of course):
PHP Code:
$server_varis=array();
$server_varis['show_menu']=$userfuncties->showMenu ();
vB_Template::preRegister('header'$server_varis); 
Note the use of 'header' in the third line corresponds directly with the specific template name where the code will be used. Then the array name can be whatever you like. It is not accessed from the template tags, just the name of the array key, which in this example was 'show menu'.

This is based off of what I just accomplished, so there may be some errors. But maybe this will help as well.

-Brent
Reply With Quote
  #3  
Old 06-20-2010, 08:17 AM
mordor1 mordor1 is offline
 
Join Date: Apr 2010
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Tanks thought it dint worked error:
Fatal error: Call to a member function showMenu() on a non-object in /www/htdocs/ontwikk/forum4/includes/init.php(331) : eval()'d code on line 2

I had to enable //define('DISABLE_HOOKS', true); (in config.php) even the admin panel was broken.
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 12: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.03521 seconds
  • Memory Usage 2,175KB
  • 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
  • (1)bbcode_html
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)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