Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)

Reply
 
Thread Tools Display Modes
  #1  
Old 10-23-2002, 06:31 PM
JakeC JakeC is offline
 
Join Date: Sep 2002
Location: Yakima, WA
Posts: 74
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Easy Question concerning $logincode

I'm sure this ground has been covered somewhere but I can't find it. Is there a hack that makes the $logincode and $logoutcode (or any other for that matter) available in the header template. Any help with this would be much appreciated. Thanks.

JakeC
Reply With Quote
  #2  
Old 10-23-2002, 07:28 PM
NTLDR's Avatar
NTLDR NTLDR is offline
Coder
 
Join Date: Apr 2002
Location: Bristol, UK
Posts: 3,644
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You would need to add the PHP code that you want above the line in global.php that eval's the header template.
Reply With Quote
  #3  
Old 10-23-2002, 07:35 PM
Erwin's Avatar
Erwin Erwin is offline
 
Join Date: Jan 2002
Posts: 7,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Add this to the bottom of your "phpinclude" template.

PHP Code:
// if user is know, then welcome
if ($bbuserinfo['userid']!=0) {
  
$username=$bbuserinfo['username'];
  eval(
"\$welcometext = \"".gettemplate('forumhome_welcometext')."\";");
  eval(
"\$logincode = \"".gettemplate('forumhome_logoutcode')."\";");
  eval(
"\$newposts = \"".gettemplate('forumhome_newposts')."\";");

} else {
  
$welcometext "";
  eval(
"\$logincode = \"".gettemplate('forumhome_logincode')."\";");

Then put your $logincode and $logoutcode in your header (or in any template). I haven't tested it, but it should work.
Reply With Quote
  #4  
Old 10-23-2002, 10:05 PM
JakeC JakeC is offline
 
Join Date: Sep 2002
Location: Yakima, WA
Posts: 74
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

First off, thanks for the replies. I have just installed the advanced dynamic templates hack by logician and I want to use the conditionals in order to decide when the logincode is displayed in the header and when its not. Someone told me that what I need to do is parse the $logincode (whatever that means, I don't know). Is there a hack already out that does this or can someone tell me how to do this? I just need the Header Template to recognize the $logincode and $logoutcode and I'll use the conditionals to do the rest. Is my thinking flawed? Please let me know. Thanks.

JakeC

Erwin, Is this what the code you posted does? I'm not a programer but it didn't seem like it. Let me know.
Reply With Quote
  #5  
Old 10-23-2002, 10:14 PM
Chris M's Avatar
Chris M Chris M is offline
 
Join Date: Dec 2001
Location: Northampton, England
Posts: 6,186
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You can only parse php code to be used in the header or footer in the phpinclude template, or the root/global.php file...

Satan
Reply With Quote
  #6  
Old 10-23-2002, 10:17 PM
NTLDR's Avatar
NTLDR NTLDR is offline
Coder
 
Join Date: Apr 2002
Location: Bristol, UK
Posts: 3,644
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by JakeC
Erwin, Is this what the code you posted does? I'm not a programer but it didn't seem like it. Let me know.
Yes, if you add that code to the phpinclude template then you can use $logincode and $logoutcode in your header and use the conditionals for it
Reply With Quote
  #7  
Old 10-23-2002, 11:56 PM
JakeC JakeC is offline
 
Join Date: Sep 2002
Location: Yakima, WA
Posts: 74
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Great!! Really appreciate the help. Thanks.

JakeC
Reply With Quote
  #8  
Old 10-24-2002, 10:55 AM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by JakeC
First off, thanks for the replies. I have just installed the advanced dynamic templates hack by logician and I want to use the conditionals in order to decide when the logincode is displayed in the header and when its not. Someone told me that what I need to do is parse the $logincode (whatever that means, I don't know). Is there a hack already out that does this or can someone tell me how to do this? I just need the Header Template to recognize the $logincode and $logoutcode and I'll use the conditionals to do the rest. Is my thinking flawed? Please let me know. Thanks.
Erwin's solution is nice..

If you want the "conditional way" of advanced templates, it's similiar to that solution: You can use:

[[($bbuserinfo[userid]>0)]]
Your header template if the user is logged in
[[/($bbuserinfo[userid]>0)]]
[[($bbuserinfo[userid]==0)]]
Your header template if the user is NOT logged in
[[/($bbuserinfo[userid]==0)]]

format in any template you like (including header)
Reply With Quote
  #9  
Old 10-24-2002, 12:06 PM
Erwin's Avatar
Erwin Erwin is offline
 
Join Date: Jan 2002
Posts: 7,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by JakeC
Erwin, Is this what the code you posted does? I'm not a programer but it didn't seem like it. Let me know.
Yes.

Also, remember to add

forumhome_welcometext, forumhome_logoutcode, forumhome_newposts, forumhome_logincode

to the end of this line in global.php in your forum folder if you want to add that code above to the phpinclude template.

PHP Code:
$templatesused.=
If you do this, you will have NO additional queries to your pages. If you don't do this, my fix could give every page an additional 3 queries if you're logged in, or 1 extra query if you're logged out.
Reply With Quote
  #10  
Old 10-24-2002, 06:50 PM
JakeC JakeC is offline
 
Join Date: Sep 2002
Location: Yakima, WA
Posts: 74
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, Thank you very much. I appreciate you letting me know. I just installed the extra snipit and everything seems ok. I've added the $logincode to the header and everything is working out. I think I really need to learn PHP so I can understand all of these hacks aranoid: . Thanks.

JakeC
Reply With Quote
Reply

Thread Tools
Display Modes

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 02:15 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.04726 seconds
  • Memory Usage 2,259KB
  • 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
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete