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 05-16-2010, 06:23 AM
kardus kardus is offline
 
Join Date: May 2010
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Need to Implement Custom Pages That Execute PHP Code

I've been doing a lot of searching around and have found a few guides that allow you to create custom pages within vbulletin, namely this guide: https://vborg.vbsupport.ru/showthread.php?t=228112

I followed it and it seems to work as advertised. Unfortunately, I want these pages to be able to execute PHP code, which doesn't seem to work with this method. I found http://www.vbulletin.com/docs/html/t..._externalfiles and tried to implement these changes for php/registering variables for vb4, but I can't seem to get it working.

Basically what I am trying to achieve is a setup like this: http://tools.digitalpoint.com so some of my own PHP web applications are streamlined with my forums.

I just need to manage some content/these web apps (most likely 10-30 pages). I tried vbadvanced which actually worked, but seemed like a huge amount of overkill for what I am trying to achieve, and I really didn't like how it was handling my pages, url issues, interference with other mods, etc.. I also tried https://vborg.vbsupport.ru/showthread.php?t=232207 but this mod seems outdated and gave me errors.

I'm basically looking for a simple, easy to implement, and working solution that doesn't involve me adding my own plugins/templates for every single new page I want, if possible. Essentially I want to run already finished php webapps that do various tasks, into my forums in the fashion as shown on digitalpoint forums.

I would really appreciate some assistance. I've been working on my forums for hours and this really is the only (but vital) thing I need to work out before they go live.

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

bump?
Reply With Quote
  #2  
Old 05-18-2010, 02:55 AM
ragtek ragtek is offline
 
Join Date: Mar 2006
Location: austria, croatia
Posts: 1,630
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

<a href="https://vborg.vbsupport.ru/showthread.php?t=228112" target="_blank">https://vborg.vbsupport.ru/showthread.php?t=228112</a> should work

what did you exactly try?
Reply With Quote
  #3  
Old 05-18-2010, 03:44 AM
kardus kardus is offline
 
Join Date: May 2010
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Oh, that worked fine. The only problem is that it only seemed to work for only HTML/plaintext. I put in some PHP code to test an output (just a simple echo for testing purposes) and it just displays the code how I wrote it. I made the plugin as seen in the vbulletin manual:
Code:
  ob_start();
  include('path/to/this/file/myfile.php');
  $includedphp = ob_get_contents();
  ob_end_clean();
and then put

Code:
{vb:raw includedphp}
in the template that Lynne's guide told me to make.

I also added
Code:
vB_Template::preRegister('FORUMHOME',array('includedphp ' => $includedphp));
To the test.php file, and it still doesn't seem to want to include my php code.

I've been trying to get this working for nearly two days now with nothing but frustration
Reply With Quote
  #4  
Old 05-18-2010, 04:30 AM
cellarius's Avatar
cellarius cellarius is offline
 
Join Date: Aug 2005
Posts: 1,987
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I can't imagine that you're using the FORUMHOME template for your custom php file, do you really? You are registering your variable for that template, but you need to register it for the template you actually use for your custom php page. If you want to output something on forumhome, you don't need a custom php page. You would put your code into a plugin.
Reply With Quote
  #5  
Old 05-18-2010, 05:04 AM
kardus kardus is offline
 
Join Date: May 2010
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by cellarius View Post
I can't imagine that you're using the FORUMHOME template for your custom php file, do you really? You are registering your variable for that template, but you need to register it for the template you actually use for your custom php page. If you want to output something on forumhome, you don't need a custom php page. You would put your code into a plugin.
I'm not sure I understand you completely. My goal is just to have pre-written pages of php/html code display neatly where the forums region would be in a normal forum, similar to http://tools.digitalpoint.com... I'm very new to vb and have not much of a clue how it works. I've just followed what I've seen here and while the custom pages are working, php is not being parsed.
Reply With Quote
  #6  
Old 05-18-2010, 05:18 AM
cellarius's Avatar
cellarius cellarius is offline
 
Join Date: Aug 2005
Posts: 1,987
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No, you did not follow the custom pages tutorial - at least not closely. You need to create your own template for your custom php page and register your variable for that template you created. You are registering it for FORUMHOME template, which most probably is wrong. What is the name of the template you created for your custom page?
Reply With Quote
  #7  
Old 05-18-2010, 05:48 AM
kardus kardus is offline
 
Join Date: May 2010
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I followed the tutorial exactly as how it was written, just to try it out and made sure I was doing it properly. My file is test.php, and my template it called TEST just as the tutorial showed.

Text and html work fine. If I put on my page: <?php Print "Hello, World!"; ?>, it will not say "Hello, World!" but rather Print "Hello, World!"; ?>

My variable registration looks like:
Code:
vB_Template::preRegister('TEST',array('includedphp ' => $includedphp));
Sorry if that was not clear, I was just pasting it from the vb manual. On my real forums, it does say 'TEST' rather than 'FORUMHOME', I know I am doing this correctly as instructed, but I don't know why php fails to parse.
Reply With Quote
  #8  
Old 05-18-2010, 08:26 AM
cellarius's Avatar
cellarius cellarius is offline
 
Join Date: Aug 2005
Posts: 1,987
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Why at all do you use the preregister method? The (correct) method in the tutorial is different and does not use preregister:
PHP Code:
$templater vB_Template::create('TEST');
$templater->register_page_templates();
$templater->register('navbar'$navbar);
$templater->register('pagetitle'$pagetitle);
print_output($templater->render()); 
For your variable you would have to add a line like this:
PHP Code:
$templater->register('includephp'$includephp); 
Concerning your test with
PHP Code:
<?php Print "Hello, World!"?>
It looks to me that you use <?php ?> while not needing to - it's already around the complete page, so if you put your code somewhere in the middle, you don't need it once again. But this is plain guesswork without seeing your code. The base line is that the tutorial works perfectly well if followed correctly, so there need to be errors in your code. It would be helpful if you would paste the whole thing, with those little tidbids it's really hard to tell.
Reply With Quote
  #9  
Old 05-18-2010, 01:59 PM
kardus kardus is offline
 
Join Date: May 2010
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Finally got it working! Thank you.

P.S. I followed what you said exactly and it STILL did not work. I was copying your line: $templater->register('includephp', $includephp); , but my variable was included, it took be about an hour to figure this out
Reply With Quote
  #10  
Old 08-13-2010, 10:51 PM
theraven1 theraven1 is offline
 
Join Date: Jan 2006
Posts: 3
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I would like to see this code if possible.. in a working site..
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 10:52 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.04343 seconds
  • Memory Usage 2,273KB
  • 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
  • (4)bbcode_code
  • (3)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete