Help with variable please

Discussion in 'PHP' started by PinoyIto, Feb 22, 2007.

  1. #1
    I am editing a free script right now, but I have problem with calling for a variable...

    The code look like this
    <title>{TITLE}</title>
    Code (markup):
    the variable title is working perfectly when embeded in html... but my problem is that I want to assign the value TITLE variable to another variable in php code...

    I tried the following

    $newvar = TITLE; , also $newvar=$TITLE

    But both approch not working....

    Thank you in advance
     
    PinoyIto, Feb 22, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    Seems like you're using some kind of template system. Are you trying to assign the variable in the template file or in the actual PHP file?

    There's probably some part in the PHP file where the template variables are assigned. Search for this part and look at the variable which is used there.
     
    nico_swd, Feb 22, 2007 IP
  3. PinoyIto

    PinoyIto Notable Member

    Messages:
    5,863
    Likes Received:
    170
    Best Answers:
    0
    Trophy Points:
    260
    #3
    Yah, actually it coppermine photo gallery script... and I am trying to locate how to get the value of TITLE variable in actual php file but no success
     
    PinoyIto, Feb 22, 2007 IP
  4. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #4
    I downloaded it quick and had a look.

    The title is defined like this in some files.
    
    '{TITLE}' => sprintf($lang_ecard_php['ecard_title'], $data['sn']),
    
    PHP:
    Seems like the language variables should be accessible everywhere. So try using this:
    (Taken and modified from displayecard.php)

    
    
    $data = array();
    $data = @unserialize(@base64_decode($_GET['data']));
    
    // attempt to obtain full link from db if ecard logging enabled and min 12 chars of data is provided and only 1 match
    if ((!is_array($data)) && $CONFIG['log_ecards'] && (strlen($_GET['data']) > 12)) {
            $result = cpg_db_query("SELECT link FROM {$CONFIG['TABLE_ECARDS']} WHERE link LIKE '{$_GET['data']}%'");
            if (mysql_num_rows($result) === 1) {
                    $row = mysql_fetch_assoc($result);
                    $data = @unserialize(@base64_decode($row['link']));
            }
    }
    
    $newvar = sprintf($lang_ecard_php['ecard_title'], $data['sn']);
    
    PHP:
     
    nico_swd, Feb 22, 2007 IP