Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

global variable - extension wide

a_ja_j
edited November 2006 in Vanilla 1.0 Help
Is there a way to create a sort of global variable in an extension folder? I'm trying to get the logged in users username via

$nick = $Context->Session->User->Name;

in default.php.

I need to get the variable into a seperate php file in the same folder. I tried using that line in the php file I need it in, but it doesn't seem to work. (I created the line with a simple echo and called the page via an iframe from the forum with pagemanager).

Is there a way to get it to work in a file other than default.php? Or a way to create it globally so I can call it in the other php file?

Much thanks for any help.

-aj

Comments

  • Options
    So it's not possible?
  • Options
    edited November 2006
    What do you want to do? Get the name of logged user in an Iframe?

    You can, add at the top of the page that will be loaded in the iframeinclude("../../appg/settings.php"); include("../../conf/settings.php"); include("../../appg/init_ajax.php");And you can use all the vanilla stuff in the page.

    Of if you can't, you can just add in your default.php, something like $SESSION['ExtensionName_NickName'] = $Context->Session->User->Name;
    And add in the iframe pageif (!session_id()) session_start(); if (isset($SESSION['ExtensionName_NickName'])) $nick = $SESSION['ExtensionName_NickName']; else $nick = '';
  • Options
    Huge thanks, Donoboff. The include was what I needed. Can't believe I missed that :(

    Another thing, do you have any idea how to order the panel? I've searched and came up with this:

    $Panel->AddString($swfcode, $Position = '500', $ForcePosition = '10');

    where $swfcode is a small flash movie I'm trying to embed. This doesn't seem to want to work for anything. No matter what I put in either position or forceposition it never changes.

    Thanks again. Your help is much appreciated.

    cheers
  • Options
    ForcePosition should be either 1 or 0 (or just not there at all) and is only used if you have extensions arguing for a position and it really matters. Set it to 1 and change the Position attribute and it should move about...
  • Options
    Thanks, Mini... But I still can't seem to get it to work, Are there some includes that need to be called in the default.php to get forceposition to work?

    Much thanks,

    aj
  • Options
    Nope...Should be fine. Can you paste the chunk of code you're using?
This discussion has been closed.