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 11-22-2003, 09:47 AM
irn-bru's Avatar
irn-bru irn-bru is offline
 
Join Date: Feb 2002
Location: Scotland
Posts: 98
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Calling a Template From A Php Page.

Calling a Template From A Php Page.

Hi

I have made a custom php page useing this code in vbulletin.

<?
require("./global.php");
eval("dooutput(\"" . gettemplate("template_1") . "\");");
?>

Now on custompage_1.php I have the htm from template_1.

In custompage_1.php I have links to other pages custompage_2.php custompage_3.php ect ect
and the templates that are called from each php page template_2 template_3 ect ect.

Now by looking at code from hacks and general php codeing I know I can use a action var
so I dont have to make more php pages just templates. So if I am on custompage_1.php
what code would I use to go to a new template via a link on the custom page to an other
template without the need to make a new php page.

Also I would like to limit viewing to guest on all but the main first template.

if ($bbuserinfo[userid]==0) {
show_nopermission();
}

This would be fine useing the extra pages but how would I use it to limit template access.
If you could amend the code or explian.

<?
require("./global.php");
eval("dooutput(\"" . gettemplate("template_1") . "\");");
?>

Its not really important I can do it either way but I would like to be a bit smarter
Reply With Quote
  #2  
Old 11-22-2003, 09:52 AM
assassingod's Avatar
assassingod assassingod is offline
 
Join Date: Jul 2002
Posts: 3,337
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You would using something like
PHP Code:
if ($action=="something")
{
$templatesused "templatename";
include(
"global.php");
     if (
$bbuserinfo[userid]==0
     {
          
show_nopermission();
     }
        eval(
"\$variable = \"".gettemplate('templatename')."\";");

Then use the link apage.php?action=something
also using $variable in the template and changing templatename to the new templte
Reply With Quote
  #3  
Old 11-22-2003, 09:57 AM
irn-bru's Avatar
irn-bru irn-bru is offline
 
Join Date: Feb 2002
Location: Scotland
Posts: 98
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yes sound stuff. thx
Reply With Quote
  #4  
Old 11-22-2003, 09:59 AM
assassingod's Avatar
assassingod assassingod is offline
 
Join Date: Jul 2002
Posts: 3,337
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No problem.
Reply With Quote
  #5  
Old 12-19-2003, 07:52 PM
ryans ryans is offline
 
Join Date: Feb 2002
Posts: 110
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

this does not appear to work on vb3. any fixes
Reply With Quote
  #6  
Old 12-20-2003, 05:08 AM
g-force2k2 g-force2k2 is offline
 
Join Date: Mar 2002
Location: Everywhere you wanna be..
Posts: 1,608
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ryans
this does not appear to work on vb3. any fixes
Assistance can not be given for any modifications for vb3 at this time. You could probably figure what to do if you look at the file differences for a little time, but unfortunately we can not help you until vb3 reaches RC.

Regards,
g-force2k2
Reply With Quote
  #7  
Old 12-20-2003, 10:49 AM
M1th's Avatar
M1th M1th is offline
 
Join Date: Jul 2002
Location: UK
Posts: 224
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

vB3 has a different get template function. Changing

PHP Code:
eval("\$variable = \"".gettemplate('templatename')."\";"); 
to

PHP Code:
eval('$variable = "' fetch_template('templatename') . '";'); 
should do the trick.


oh and..

print_no_permission();

instead of show_nopermission();
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 07:50 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.03910 seconds
  • Memory Usage 2,222KB
  • 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
  • (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
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)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