Author Topic: $site_sess variable in footer  (Read 8459 times)

0 Members and 1 Guest are viewing this topic.

Offline nyiguinyogui

  • Pre-Newbie
  • Posts: 6
    • View Profile
$site_sess variable in footer
« on: November 28, 2005, 05:24:51 PM »
Hello,

In my footer.html I need to use the $site_sess variable but, while it is set in header.html, it seems empty in footer.html.

For example, this code:
Code: [Select]
<? if ($site_sess->user_info['user_level']==ADMIN) { ?>
you are admin
<? } ?>
would work ok in header.html but not in footer.html, as the variable $site_sess seems to be unset.

Can anybody please tell me how to "propagate" this variable, $site_sess, so that it can be used from within footer.html?

Thank you.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: $site_sess variable in footer
« Reply #1 on: November 29, 2005, 02:25:01 AM »
if the user level is only what you need you can use {if is_admin} {endif is_admin} tags

Otherwise, you'll need add
Code: [Select]
<?php
global $site_sess;
?>
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline nyiguinyogui

  • Pre-Newbie
  • Posts: 6
    • View Profile
Re: $site_sess variable in footer
« Reply #2 on: November 29, 2005, 09:15:26 AM »
Thanks a lot V@no. This is exactly what I needed.

I had been trying to get this by touching page_header.php and didn't get it.
So, now I am curious to know which lines in the code are responsible for the fact that $site_sess is set within header.html.

Thank you.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: $site_sess variable in footer
« Reply #3 on: November 29, 2005, 02:43:45 PM »
none...I dont know why it worked for you in header.html :?
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline nyiguinyogui

  • Pre-Newbie
  • Posts: 6
    • View Profile
Re: $site_sess variable in footer
« Reply #4 on: December 02, 2005, 10:30:33 AM »
Well, since I installed 4images some months ago, I have been touching the code here and there so that it fits my needs. I installed some mods from the forum, but also did developments on my own for very specific needs.
So, according to what you say, I presume I probably managed to get site_sess readable from header.html (which, I am conscious about it, may lead to a security problem).
Regards.