Results 1 to 2 of 2

Thread: Include session variables in php tags

  1. #1
    Join Date
    Mar 2008
    Posts
    9

    Default Include session variables in php tags

    Hi I am using the older version of vshare and have come across a problem.

    I am trying to run some custom php code in the template. The following seems to work ok

    PHP Code:
    if ($smarty.session.USERNAME == $uname
    however I need to try and use $smarty.session.USERNAME in an sql query but then it does not work because of the periods's in the variable.

    I know php sometimes converts them to underscores but $smarty_session_USERNAME is no good either.

    I have tried

    PHP Code:
    $login $smarty.session.USERNAME;
    $login $smarty_session_USERNAME 
    Anyone have any ideas how I can use that within {php} tags?

  2. #2

    Default

    Hi,

    You must first enable {php} tags in template by adding the following code in vShare/include/vshare.php file.
    Code:
    $smarty->allow_php_tag = true;
    After
    Code:
    $smarty->caching = 0;
    Now you can use php session variables within {php} tags in templates.
    Code:
    $login = $_SESSION['USERNAME'];
    Try this.
    Last edited by vshare2; 01-05-2012 at 05:06 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •