私はjoomla Webサイトで作業しています。一部の開発者は、都市の選択に関するデータを表示するモジュールを作成しました。コードは joomla 1.5 で正常に動作していましたが、joomla をアップグレードすると、フィルタリングせずにすべてのデータが表示されます。私はちょうど解決に取り組んでいます。私はコーディングしませんでした。コードは次のとおりです。php 5.3 から廃止されたものはありますか?
// no direct access
defined('_JEXEC') or die('Restricted access');
if(isset($_SESSION['CITY_SELECTION'])){
$selected_city = $_SESSION['CITY_SELECTION'];
}
else {
$selected_city = '-SELECT A CITY-';
}
echo "<div id='city_selector'><form name='CITY_SELECTION_FORM' method='get' action='/residential-home.html'>" ;
echo "<SELECT id='city_input' name='CITY_SELECTION' onchange='this.form.submit();'>";
echo $selected_city;
foreach ($cities as $city=>$cityname)
{
$select = "";
if(strtolower(trim($selected_city))==strtolower(trim($cityname)))
{
$select = " SELECTED";
}
else
{
$select = "";
}
echo "<OPTION value='".$cityname."'".$select."> ".$cityname."</option>";
}
echo '</select>';
echo '</form></div>';
mod_cityselection.php
// no direct access
defined('_JEXEC') or die('Restricted access');
// Include the syndicate functions only once
require_once (dirname(__FILE__).DS.'helper.php');
$cities = CitySelection::getCities();
require(JModuleHelper::getLayoutPath('mod_cityselection'));
helper.php
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
class CitySelection
{
/**
* Returns a list of cities
*/
public function getCities()
{
// get a reference to the database
$db = &JFactory::getDBO();
// get the list of cities in the custom city_selection
$query = 'SELECT CS.cityname FROM #__city_selection AS CS Order By cityname ASC;';
$db->setQuery($query);
$cities = $db->loadResultArray();
return $cities;
} //end getCities
} //end CitySelection