vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Easy Question concerning $logincode (https://vborg.vbsupport.ru/showthread.php?t=44910)

JakeC 10-23-2002 06:31 PM

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

NTLDR 10-23-2002 07:28 PM

You would need to add the PHP code that you want above the line in global.php that eval's the header template.

Erwin 10-23-2002 07:35 PM

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. :)

JakeC 10-23-2002 10:05 PM

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.

Chris M 10-23-2002 10:14 PM

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

NTLDR 10-23-2002 10:17 PM

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 :)

JakeC 10-23-2002 11:56 PM

Great!! Really appreciate the help. Thanks.

JakeC

Logician 10-24-2002 10:55 AM

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)

Erwin 10-24-2002 12:06 PM

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.

JakeC 10-24-2002 06:50 PM

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 :paranoid: . Thanks.

JakeC


All times are GMT. The time now is 12:39 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.00984 seconds
  • Memory Usage 1,738KB
  • 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
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete