Ciao a tutti,

volevo sapere come si potrebbe rendere uno script di quelli "pronti" (per l'esattezza è autoboss 3.0) multilingua. Per modificarlo infatti dovrei cambiare le diciture all'interno di ogni singolo file php... a questo punto, lavoro per lavoro, sarebbe molto bello poter mettere direttamente un file di lingua con all'interno tutte le variabili che mi interessano.

Per farvi capire, vi posto il codice di uno dei file php. In pratica mi servirebbe sapere come "collegare" il file della lingua e come scrivere correttamente il codice per inserire la variabile al posto del nome.

Spero di essere stato chiaro... purtroppo le mie conoscenze in fatto di programmazione sono pressochè nulle.

Codice PHP:

<div class='search'>
    
    <form action='<?php echo $_SERVER[PHP_SELF]; ?>' method='get'>
    <table width='660' border='0' cellpadding='0' cellspacing='0'>
        <tr>
            <th width='120'><label for='category'>Category:</label></th>
            <th width='120'><label for='make'>Make:</label></th>
            <th width='120'><label for='model'>Model:</label></th>
            <th width='150'><label for='srt'>Sort Order:</label></th>
            <th width='90'><label for='p'>Per Page:</label></th>
            <th width='60'></th>
        </tr>
        <tr>
            <td>
                <select id='category' name='category' style='width:110px;'>
                    <option value=''>[ Any Category ]</option>
                    <?php
                    $result 
mysql_query("SELECT DISTINCT category FROM $dblist ORDER BY category ASC"$link);
                    if(
mysql_num_rows($result)) {
                        while(
$row mysql_fetch_array($result)) {
                            
$row safe_data($row'display');
                            echo 
"<option value='$row[category]'";
                            if(
$row[category] == $_GET[category]) echo "selected='selected'";
                            echo 
">$row[category]</option>";
                        }
                    }
                    
?>
                </select>
            </td>
            <td>
                <select id='make' name='make' style='width:110px;'>
                    <option value=''>[ Any Make ]</option>
                    <?php
                    $result 
mysql_query("SELECT DISTINCT make FROM $dblist ORDER BY make ASC"$link);
                    if(
mysql_num_rows($result)) {
                        while(
$row mysql_fetch_array($result)) {
                            
$row safe_data($row'display');
                            echo 
"<option value='$row[make]'";
                            if(
$row[make] == $_GET[make]) echo "selected='selected'";
                            echo 
">$row[make]</option>";
                        }
                    }
                    
?>
                </select>
            </td>
            <td>
                <input id='model' name='model' value='<?php echo $_GET[model]; ?>' style='width:106px;'/>
            </td>
            <td>
                <select id='srt' name='srt' style='width:140px;'>
                    <option value='model_year DESC' <?php if($_GET[srt] == 'model_year DESC') echo "selected='selected'"?>>By Year (New to Old)</option>
                    <option value='model_year ASC' <?php if($_GET[srt] == 'model_year ASC') echo "selected='selected'"?>>By Year (Old to New)</option>
                    <option value='make ASC' <?php if($_GET[srt] == 'make ASC') echo "selected='selected'"?>>By Make (A to Z)</option>
                    <option value='make DESC' <?php if($_GET[srt] == 'make DESC') echo "selected='selected'"?>>By Make (Z to A)</option>
                    <option value='added DESC' <?php if($_GET[srt] == 'added DESC') echo "selected='selected'"?>>By Date (New to Old)</option>
                    <option value='added ASC' <?php if($_GET[srt] == 'added ASC') echo "selected='selected'"?>>By Date (Old to New)</option>
                    <option value='price DESC' <?php if($_GET[srt] == 'price DESC') echo "selected='selected'"?>>By Price (High to Low)</option>
                    <option value='price ASC' <?php if($_GET[srt] == 'price ASC') echo "selected='selected'"?>>By Price (Low to High)</option>
                </select>
            </td>
            <td>
                <select id='p' name='p' style='width:80px;'>
                    <?php for($n 5$n <= 50$n+=5) {
                    echo 
"<option value='$n'";
                    if(
$n == $_GET[p]) echo " selected='selected'";
                    echo 
">$n Results</option>";
                    } 
?>
                </select>
            </td>
            <td align='right'>
                <input type='submit' name='submit' value='Search'/>
            </td>
        </tr>
    </table>
    </form>
    
</div>

<div class='infobar' style='margin-bottom:10px;'>
    
    There are [b]<?php echo number_format($display_total[0]); ?>[/b] listings in inventory.
    (Last updated: <?php echo date($conf[dformat], $updated[updated]+(3600*$conf[toffset])); ?> at
    <?php echo date($conf[tformat], $updated[updated]+(3600*$conf[toffset])); ?>)
    
    <div class='right'>
        [url='listings.php']Browse[/url]-
        [url='search.php?<?php echo $pass_vars?>']Advanced Search[/url]
    </div>
    
</div>

<form action='compare.php' method='get'>

<?php
if($conf[featured]) $first "featured DESC,"; else $first "";
$result mysql_query("SELECT * FROM $dblist $where ORDER BY $first $_GET[srt] LIMIT $start$_GET[p]"$link);
if(
mysql_num_rows($result)) {

    
$n 0;
    while(
$row mysql_fetch_array($result)) {
        
        
// determine which image to display
        
if($row[images]) {
        
            
$image mysql_query("SELECT fname FROM $dbimgs WHERE listid='$row[id]' ORDER BY id ASC LIMIT 1"$link);
            
$image mysql_fetch_array($image);
            
$image "thumbs/".$image[fname];
        
        } else {
        
            
$image "common/no-photo-thumb.jpg";
        
        }
        
        
// make data display-friendly
        
$row safe_data($row'display');
        
        if(
$n 2$alternate "alt"; else $alternate "";
                    
        
// create variable string to pass
        
$show "show.php?id=$row[id]";
        foreach(
$_GET as $name => $value) if($name != 'id'$show .= "&amp;$name=$value";
        
        echo 
"<div class='listing $alternate'>";
        
        
// featured status
        
if($row[featured]) echo "<div class='featured'>F E A T U R E D</div>";
        
        
// photo
        
echo "<div class='photo'>[url='$show'][img]$image[/img][/url]</div>";
        
        
// general information
        
echo "<div class='info'>";
        echo 
"<a href='$show'>[b]";
        if(
$row[model_year]) echo $row[model_year]." ";
        echo 
"$row[make] $row[model][/b]</a>";
        if(
$row[mileage]) echo "(".number_format($row[mileage]).$conf[units])";
        echo 
"
"
;
        if(
$row[stock]) echo "Stock Number: $row[stock]
"
;
        if(
$row[trans]) echo "Transmission: $row[trans]
"
;
        echo 
"</div>";
        
        
// description summary
        
echo "<div class='description'>";
        if(
$row[tagline]) echo "[b]$row[tagline][/b]";
        elseif(
$row[description]) echo summary($row[description], 15)." [url='$show']More Details[/url]";
        echo 
"</div>";
        
        
// price, availability, condition
        
echo "<div class='price'>";
        
        echo 
"[b]";
        if(
$row[ebay_url]) echo "[url='$row[ebay_url]'][img]common/ebay-logo.gif[/img][/url]";
        elseif(
$row[price])    echo $conf[currency].number_format($row[price]);
        elseif(
$row[price_alt]) echo $row[price_alt];
        else echo 
"Call for Price";
        if(
$row[sale]) echo "
<span class='success'>Sale: "
.$conf[currency].number_format($row[sale])."</span>";
        echo 
"[/b]
"
;
        
        if(
$row[status] == 2) echo "<span class='alert'>".$status[$row[status]]."</span>
"
;
        elseif(
$row[status] == 3) echo "<span class='error'>".$status[$row[status]]."</span>
"
;
        else echo 
"[b]".$status[$row[status]]."[/b]
"
;
        
        echo 
$row[cond];
        
        echo 
"</div>";            
        
        
// compare check box
        
echo "<div class='compare'>";
        echo 
"<input class='check' type='checkbox' name='cmp$row[id]' value='1'/> Compare";
        echo 
"</div>";
        
        echo 
"</div>";
        
        
$n++;
    }
    
} else {

    echo 
"<div id='msg-alert'>We're sorry, no listings could be found that match your query.</div>";

}
?>

<div class='infobar' style='margin-top:10px;'>

    To compare listings check up to [b]3[/b] checkboxes above and click the [b]Compare[/b] button.
    
    <div class='right' style='padding-top:4px;'>
        <input class='compare' type='submit' value='Compare'/>
    </div>
    
</div>

</form>

<div class='pages'>

    Page <?php echo $_GET[page]; ?> of <?php echo $pages?>(<?php echo $total?> Listings)
    
    <?php if($pages 1) { ?>
    <div class='links'>
        <?php $_GET safe_data($_GET'display'); page_links($_GET$pages$_SERVER[PHP_SELF]); ?>
    </div>
    <?php ?>
    
</div>
Grazie in anticipo a tutti!