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

Reply
 
Thread Tools Display Modes
  #1  
Old 04-16-2002, 11:10 PM
jjj0923's Avatar
jjj0923 jjj0923 is offline
 
Join Date: Mar 2002
Location: Maryland
Posts: 146
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default getting a $name evaluated

I'm somewhat confused.

I've developed some additional code in index.php

PHP Code:
$fbmenu='';
if (
$lastphoto $userlastvisit) { 
    eval(
"\$fbmenu = \"".gettemplate('fb_menu')."\";"); 
} else {  
    eval(
"\$fbmenu = \"".gettemplate('fb_menu1')."\";"); 


I've added fb_menu and fb_menu1 to my templates and added $fbmenu to the code in the 'Header' template but it won't evaluate and display the html contained in the fb_menu or fb_menu1 template.
My php code is down near the bottom of index.php and it outside of any conditional clauses and I know it's working fine because I did lots of testing before implementing it.

Does Vbulletin NOT evaluate code in templates (such as header)?
I've done this before but and added $variables associated with templates in index.php but the results of that code ($'name') was placed in forum_home

this one really has me stumped.... I know my php code is working, but vb doesn't want to associate $fbmenu with my template... any ideas???

thanks in advance.

- jeff
Reply With Quote
  #2  
Old 04-17-2002, 08:11 AM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You need to place that code in global.php before $header is eval()'ed.
Reply With Quote
  #3  
Old 04-17-2002, 10:26 AM
jjj0923's Avatar
jjj0923 jjj0923 is offline
 
Join Date: Mar 2002
Location: Maryland
Posts: 146
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

firefly, I'm almost there, byt placing the code right before loading the header template breaks the following:

1) logged out users cannot log-in
2) new users that have just registered cannot log in.

other than that; the code (for registered users) who have not logged out works great.

here's my code; do you have any ideas?

PHP Code:
// begin hack for testing when last photo was posted compared to last date user visited site

$fbmenu='';
eval(
"\$fbmenu = \"".gettemplate('fb_menu')."\";");

echo 
$userlastvisit;

$user=$DB_site->query_first("SELECT * FROM user WHERE userid=$bbuserinfo[userid]");
$username=$user[username];
$userlastvisit=$user['lastvisit'];

$db1name "PhotoPost_info";          
$link_id mysql_connect($servername$dbusername$dbpassword);
mysql_select_db($db1name$link_id);
$result mysql_query("SELECT max(photos.date) as lastphoto from photos");
while(
$query_data mysql_fetch_row($result)) { $lastphoto $query_data[0]; }
mysql_select_db($dbname);

if (
$lastphoto $userlastvisit) {
        eval(
"\$fbmenu = \"".gettemplate('fb_menu')."\";");
    } else {
        eval(
"\$fbmenu = \"".gettemplate('fb_menu1')."\";");
    }

// end hack 
Reply With Quote
  #4  
Old 04-17-2002, 04:23 PM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You use $username in your code which breaks the log-in form. Just use $bbuserinfo[username] and $bbuserinfo[lastvisit], you don't need another query for that. And you also don't need to create another database connection, just use the current opened one.
Reply With Quote
  #5  
Old 04-17-2002, 05:18 PM
jjj0923's Avatar
jjj0923 jjj0923 is offline
 
Join Date: Mar 2002
Location: Maryland
Posts: 146
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

oh yea...
much nicer...
I also changed the perl code in Photo Post to simply write a 10 character text file with the most recent post date and used an fopen in global.php to read it....

much nicer, much faster and working great!

thank!

- jeff
Reply With Quote
  #6  
Old 04-17-2002, 05:53 PM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No problems.
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 05:49 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.04830 seconds
  • Memory Usage 2,219KB
  • 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
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)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