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 07-31-2007, 08:56 PM
Osterling Osterling is offline
 
Join Date: Jan 2004
Posts: 381
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Pulling Templates

I am developing a File Sharing system, which after it's done, I would like to release it here. I have only one problem, vbulletin template based system. I need a way to retrieve the header, headinclude, and footer. I started doing it my way, which was this.

I'd search the table user for the persons username, and then check out what their default style was. After that, I did a search in the table template with the conditions being styleid, and searching for the specific template I wanted (eg navbar). Once I did that, I saw that I would need to search the phrase table in order to replace things like, $vbphrase[members_list].

I think I could eventually get it to work right, but I think it would be a heck of a lot of code, and querying. I'm hoping someone could show me a easier way in retrieving templates. So if someone wouldn't mind taking me under the wing, I'd really appreciate it.

p.s. I'll give recognition to who ever helps me when I release the File Sharing system

Thank you,
Osterling.
Reply With Quote
  #2  
Old 07-31-2007, 09:14 PM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm still a bit of a coding rookie but using:

PHP Code:
eval('print_output("' fetch_template('test_mytesttemplate1') . '");'); 
Should automatically select the template from the users selected style and replace the phrases if you have set them in the templates.

Source: https://vborg.vbsupport.ru/showthread.php?t=98009
Reply With Quote
  #3  
Old 07-31-2007, 09:56 PM
Osterling Osterling is offline
 
Join Date: Jan 2004
Posts: 381
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you, that got line of code got me a bit further but still having problems. It displays the header, but it doesn't display the navbar or footer. It is almost like it stops loading after that line.

PHP Code:
<?php
/* vBulletin Information Retrieval*/
$curdir getcwd ();
chdir('/home/shhh/public_html/');
require_once(
'/home/shhh/public_html/global.php5');
chdir ($curdir);

/* Name and User Id of User*/
$user_id $vbulletin->userinfo['userid'];
$user_name $vbulletin->userinfo['username']; 

/*Find out what style a user has selected and retrieve the CSS for that style */
$user_sql "SELECT * FROM user WHERE username = '$user_name'";
$execute_user_sql mysql_query($user_sql);
$number_of_retrievals mysql_num_rows($execute_user_sql);

if(
$number_of_retrievals == "1"){
    
$user_information mysql_fetch_array($execute_user_sql);
    
$style_id $user_information[styleid];

    if(
$style_id == "0" || $style_id == "1"){
        
$style_sql "SELECT * FROM style WHERE styleid = '1'";
        
$execute_style_sql mysql_query($style_sql);
        
$style_information mysql_fetch_array($execute_style_sql);
        
$style_css $style_information[css];
        echo 
$style_css;
    }
    else{
        
$style_sql "SELECT * FROM style WHERE styleid = '$style_id'";
        
$execute_style_sql mysql_query($style_sql);
        
$style_information mysql_fetch_array($execute_style_sql);
        
$style_css $style_information[css];
        echo 
$style_css;
    }
}
else{
    
$style_sql "SELECT * FROM style WHERE styleid = '1'";
    
$execute_style_sql mysql_query($style_sql);
    
$style_information mysql_fetch_array($execute_style_sql);
    
$style_css $style_information[css];
    echo 
$style_css;
}

echo eval(
'print_output("' fetch_template('header') . '");');

echo eval(
'print_output("' fetch_template('navbar') . '");');

echo eval(
'print_output("' fetch_template('footer') . '");');
?>
Reply With Quote
  #4  
Old 07-31-2007, 10:08 PM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Look at the source link I provided in the first post. If you follow it through it should show you how to use templates to create custom vBulletin pages.
Reply With Quote
  #5  
Old 07-31-2007, 10:17 PM
Osterling Osterling is offline
 
Join Date: Jan 2004
Posts: 381
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I did check it out. Though the page I am creating, I don't want to call it from the template system, instead call it from a flat file using PHP. So I want to display the Header, Navbar, then have it load my file, followed by the footer.

For some reason, it just stops loading after

PHP Code:
echo eval('print_output("' fetch_template('header') . '");'); 
When I swap it with footer, or navbar, it will display. For some reason it just stops loading after the first eval() statement.

I did check it out. Though the page I am creating, I don't want to call it from the template system, instead call it from a flat file using PHP. So I want to display the Header, Navbar, then have it load my file, followed by the footer.

For some reason, it just stops loading after

PHP Code:
echo eval('print_output("' fetch_template('header') . '");'); 
When I swap it with footer, or navbar, it will display. For some reason it just stops loading after the first eval() statement.
Reply With Quote
  #6  
Old 07-31-2007, 10:26 PM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try to change the print_output to just print then as the print_output stops the execution. Also I don't think you need the echo function at the start.
Reply With Quote
  #7  
Old 08-01-2007, 06:11 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Take a look at the article about creating vBulletin-powered pages.
Reply With Quote
  #8  
Old 08-01-2007, 06:32 AM
Adrian Schneider's Avatar
Adrian Schneider Adrian Schneider is offline
 
Join Date: Jul 2004
Posts: 2,528
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here's your general problem:

PHP Code:
eval('print_output("' fetch_template('MAIN_TEMPLATE') . '");'); 
Stops executing the script, and prints (evaluates) that template. So, before you call that, you'll need to set the other templates as variables like this:
PHP Code:
eval('$navbar = "' fetch_template('navbar') . '";'); 
Then $navbar will be available in your MAIN_TEMPLATE.

Prior to including global.php, be sure to populate an array of all the templates you plan to use and name it $globaltemplates, so vBulletin can cache them for you.

(Do read that tutorial)
Reply With Quote
  #9  
Old 08-20-2007, 04:15 PM
utw-Mephisto utw-Mephisto is offline
 
Join Date: Jan 2005
Posts: 648
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I subscribe to this thread .. I am exactly in the same position and I have the exact same reason why I need header, footer etc.
Reply With Quote
  #10  
Old 08-21-2007, 12:55 PM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Did you read the replies to the thread?
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 12:00 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.05032 seconds
  • Memory Usage 2,274KB
  • 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
  • (6)bbcode_php
  • (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