Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it
    Registrato dal
    Jan 2002
    Messaggi
    93

    Aiuto array incluso tramite funzione

    salve a tutti ho due file
    uno language/en/main.php
    <?
    $lang["powered_by"] = "Powered by";
    ?>
    e uno pippo.php
    <?
    $phpEx = 'php';
    $default_language = 'en';
    $phpms_root_path = './';

    function inc_lang($filename)
    {
    global $phpms_root_path, $module_root_path, $default_language, $phpEx;

    //
    //Check for language file into module folder
    //
    if( file_exists($module_root_path . 'language/' . $user["lang"] . '/' . $filename . '.' . $phpEx))
    {
    $filepath = $module_root_path;
    $script_lang = $user["lang"];
    }
    else if( file_exists($module_root_path . 'language/' . $HTTP_SERVER_VARS['HTTP_ACCEPT_LANGUAGE'] . '/' . $filename . '.' . $phpEx))
    {
    $filepath = $module_root_path;
    $script_lang = $HTTP_SERVER_VARS['HTTP_ACCEPT_LANGUAGE'];
    }
    else if( file_exists($phpms_root_path . 'language/' . $script_config["lang"] . '/' . $filename . '.' . $phpEx))
    {
    $filepath = $module_root_path;
    $script_lang = $portal_config["lang"];
    }
    else if( file_exists($phpms_root_path . 'language/' . $default_language . '/' . $filename . '.' . $phpEx))
    {
    $filepath = $module_root_path;
    $script_lang = $default_language;
    }
    //
    //If not found into module folder check in PhpMS folder
    //
    else if( file_exists($phpms_root_path . 'language/' . $user["lang"] . '/' . $filename . '.' . $phpEx))
    {
    $filepath = $phpms_root_path;
    $script_lang = $user["lang"];
    }
    else if( file_exists($phpms_root_path . 'language/' . $HTTP_SERVER_VARS['HTTP_ACCEPT_LANGUAGE'] . '/' . $filename . '.' . $phpEx))
    {
    $filepath = $phpms_root_path;
    $script_lang = $HTTP_SERVER_VARS['HTTP_ACCEPT_LANGUAGE'];
    }
    else if( file_exists($phpms_root_path . 'language/' . $script_config["lang"] . '/' . $filename . '.' . $phpEx))
    {
    $filepath = $phpms_root_path;
    $script_lang = $portal_config["lang"];
    }
    else if( file_exists($phpms_root_path . 'language/' . $default_language . '/' . $filename . '.' . $phpEx))
    {
    $filepath = $phpms_root_path;
    $script_lang = $default_language;
    }

    include($filepath . 'language/' . $script_lang . '/' . $filename . '.' . $phpEx);
    }

    inc_lang(main);

    echo $lang["powered_by"];

    ?>
    il mio problema è il file main viene incluso correttamente, ma non mi vengono resttuiti i valori dell'array perchè?

  2. #2
    Utente di HTML.it
    Registrato dal
    Jan 2002
    Messaggi
    93
    risolto non avevo dichiarato $lang globale scusate il disturbo

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.