vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   Calling a template on command line (https://vborg.vbsupport.ru/showthread.php?t=59240)

WeBBy 12-17-2003 07:05 PM

Calling a template on command line
 
What UI am trying to do is call a specific template from the command line, something like...

http://mysite.com/forum/index.php?template=forumhome
http://mysite.com/forum/index.php?template=articlehome
http://mysite.com/forum/index.php?te...=marketinghome
http://mysite.com/forum/index.php?template=whateva

I imagine I need some sort of moderator in index.php to do this. Can anyone help me out?

Thanx

g-force2k2 12-17-2003 08:55 PM

This code should achieve the effect that you're looking for.
PHP Code:

if ( $template )
{
    eval ( 
"dooutput ( \"" gettemplate $template ) . "\" ) ;" ) ;


Regards,
g-force2k2

WeBBy 12-17-2003 09:17 PM

SWEET !!!! :D

Thank you m8 - works perfect! Just the ticket I needed. If I leave in the
eval("dooutput(\"".gettemplate('forumhome')."\");" );
then it defaults to forumhome if I dont specify the template=

Thanx again :D

g-force2k2 12-17-2003 09:22 PM

Hey no problem glad that you appreciate the help.

Regards,
g-force2k2

WeBBy 12-18-2003 03:45 AM

Just noticed a minor problem (I was wrong above - spoke a little too soon)

If a Template is NOT specified, I get "<!-- // End of vbPortal calendar script " .. hmmmm

If I leave the eval("dooutput(\"".gettemplate('forumhome')."\");" ); statement in, then I actually get both my called template and the forumhome template all on the same page.

This should be easy (but I am stupid), but I could use a statement to use forumhome if no template specified. That would really just be a fallback cause I am gonna specify a template with almost anything - more worried about the script making the call itself.

Tyhanx much again :D

WeBBy 12-19-2003 05:01 AM

Any help on this one. What I need is a statement to go along with

if ( $template )
{
eval ( "dooutput ( \"" . gettemplate ( $template ) . "\" ) ;" ) ;
}

so that if template=null (i.e., no template called), the forumhome or other default template is used. As it stands now, if I just use index.php, I get a blank page because no template is used.

Thanx again if you can help :D

g-force2k2 12-19-2003 11:32 AM

Its alright Webby, anyhow i recoded to fix the changes that you talked about and also added something to restrict calling a specific template on command so that they don't end up with a white page.

PHP Code:

$main_temps "forumhome,articlehome" // Add new valid template names here seperate by commas

$temp_arr explode ","$main_temps ) ;
if ( 
$template ) :
    if ( !
in_array $template$temp_arr ) ) :
        
$template "forumhome" ;
    endif ;
else :
    
$template "forumhome" ;
endif ;
    eval ( 
"dooutput ( \"" gettemplate $template ) . "\" ) ;" ) ; 

Regards,
g-force2k2


All times are GMT. The time now is 11:18 AM.

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.01512 seconds
  • Memory Usage 1,729KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete