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

Reply
 
Thread Tools Display Modes
  #1  
Old 09-21-2005, 10:16 PM
unknowngiver unknowngiver is offline
 
Join Date: Jul 2005
Posts: 121
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default PHP in template

Hey

I really need help

i followed this tutorial to make my own page
https://vborg.vbsupport.ru/showthrea...4&page=1&pp=15

it works 100% fine if i add HTML to my custom page

BUT I WANT TO ADD php in my custom page and it wont work

the page just doesnt run the php commands...its just like EMPTY PAGE

can any1 help me? please

any1
Reply With Quote
  #2  
Old 09-23-2005, 03:09 PM
unknowngiver unknowngiver is offline
 
Join Date: Jul 2005
Posts: 121
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

anyone
Reply With Quote
  #3  
Old 09-23-2005, 03:13 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You can't use PHP in Templates. Point.
Reply With Quote
  #4  
Old 09-25-2005, 12:33 PM
pyro.699 pyro.699 is offline
 
Join Date: Sep 2005
Location: Fredericton, New Brunswic
Posts: 261
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

umm, yeah, i was having this problem! but, ill show you how 2 fix it ^^

PHP Code:
ob_start(); 
all of your script, that you want to appear,

only do it for your suctom part, the stuff at the top, it alwasy works ^^
PHP Code:
$name_your_template_code ob_get_contents();
ob_end_clean(); 
now, go to oyur template and where you want the code to appear, type: $name_your_template_code

if you get stuck, lme know...
Reply With Quote
  #5  
Old 09-27-2005, 03:45 PM
unknowngiver unknowngiver is offline
 
Join Date: Jul 2005
Posts: 121
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

k
can u explain this please
where do i add the PHP code in the code tht u gave me
lets say thts my php code

<?php
echo 'blah blah blah'
print ' test'
$name= 'test'
$name2 = 'test1'
echo $name . $name2
echo 'more php stuff
?>

How would i do that ?

and where do i add the code tht u provide me?

do i still use tht tutorial for custom page?
Reply With Quote
  #6  
Old 09-27-2005, 08:37 PM
pyro.699 pyro.699 is offline
 
Join Date: Sep 2005
Location: Fredericton, New Brunswic
Posts: 261
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

(yes, you need 2 do teh custom template)

ok, np...
PHP Code:
<?php
//all the template stuff for vbulletin, it is required
//put  ob_start(); around your custom code only
ob_start();
echo 
'blah blah blah'
print ' test'
$name'test'
$name2 'test1'
echo $name $name2
echo 'more php stuff
$randomname = ob_get_contents();
ob_end_clean()
?>
ok, now, if you have done your template, all you have to add is add
PHP Code:
$randomname 

hope this works ^^
Reply With Quote
  #7  
Old 09-28-2005, 05:11 AM
Neutral Singh's Avatar
Neutral Singh Neutral Singh is offline
 
Join Date: Sep 2004
Location: Sikh Philosophy Network
Posts: 545
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

useful stuff pyro, thanks
Reply With Quote
  #8  
Old 09-28-2005, 09:32 AM
pyro.699 pyro.699 is offline
 
Join Date: Sep 2005
Location: Fredericton, New Brunswic
Posts: 261
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No prob, lme know if you need anything!
Reply With Quote
  #9  
Old 11-24-2005, 02:55 PM
unknowngiver unknowngiver is offline
 
Join Date: Jul 2005
Posts: 121
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

k so pyro the code u gave me is for the template...not the php file right?
Reply With Quote
  #10  
Old 12-11-2005, 01:12 AM
AutoXer AutoXer is offline
 
Join Date: Nov 2005
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by unknowngiver
k so pyro the code u gave me is for the template...not the php file right?

No. The php code goes in the php file. It must be placed before this line:

PHP Code:
eval('print_output("' fetch_template('test_mytesttemplate1') . '");'); 
In this case the only thing that gets added into the template is $randomname. Place it wherever you want the php code to go.
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 03:23 PM.


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.04366 seconds
  • Memory Usage 2,250KB
  • 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
  • (5)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete