I'm working on the php code of someone else and have a problem with the user/menu language. This is the code of the page with the dynamic price list for banner ads on this website. Depending on the selected menu language, the user can see the price of the banner ads which are for each menu language different.
Whenever the user is coming to this page the active banner ads price should be for the users menu language. Right now it's fixed on russian language and I don't know how to make it dynamicly or at least change/fix it to english.
Please have a look and let me konw if you might see a solution. Thanks!
<?php
class reklama_content
{
private $db;
private $cms;
private $valid;
private $data;
private $tools;
public function __construct()
{
$reg = Registry::getInstance();
$this->db = $reg->get('db');
$this->cms = $reg->get('cms');
$this->valid = $reg->get('Validate');
$this->data = $reg->get('methodData');
$this->tools = $reg->get('tools');
}
public function get_reklama_content()
{
$lang = language::getLang();
if ($_GET['ryb'])
$ryb = $_GET['ryb'];
else
$ryb = 'banners';
if ($ryb == 'banners')
$ret = $this->getBanner($lang);
elseif ($ryb == 'classifieds')
$ret = $this->getClassifieds($lang);
return $ret;
}
public function getClassifieds($lang)
{
$contetn = $this->db->selectArray($this->db->Select('*', 'block', "`name` = 'classifieds_content'"));
$ret = $contetn['content_' . $lang];
return $ret;
}
public function getBanner($lang)
{
$header = array();
$top = array();
$center = array();
$bottom = array();
$banners = $this->db->selectAssoc($this->db->Select('*', 'banners', false, 'page_id', false, true));
$contetn_top = $this->db->selectArray($this->db->Select('*', 'block', "`name` = 'reklams_baner_top'"));
$contetn_bottom = $this->db->selectArray($this->db->Select('*', 'block', "`name` = 'reklams_baner_bottom'"));
foreach ($banners as $x => $y) {
if ($y['position'] == 'header')
$header[$x] = $y;
elseif ($y['position'] == 'top')
$top[$x] = $y; elseif ($y['position'] == 'center')
$center[$x] = $y; elseif ($y['position'] == 'bottom')
$bottom[$x] = $y;
}
$ret = $contetn_top['content_' . $lang];
$langs = ($this->tools->getAllLang(true));
$ret .= '
<hr style="width: 100%; margin: 40px 0;" />
<div class="rek_banner_conteiner header_conteiner">
<span class="ban_title">' . l::top_banner1() . '</span>
<img src="styles/them_01/img/banner_468x60.jpg" class="header_example" />
<div class="lang_menu">' . l::menu_language1() . '<br />';
$ret .= '<span id="eng_header" >' . l::english() . '</span>';
$ret .= '<span id="de_header" >' . l::german() . '</span>';
$ret .= '<span id="rus_header" >' . l::russian() . '</span>';
$ret .= '<span id="tr_header" >' . l::turkish() . '</span>';
$ret .= '</div>';
foreach ($langs as $z => $g) {
$ret .= '
<div id="' . $g['name'] . '_header_box" class="hide">
<table>
<tr class="order_table_title">
<td class="order_table_position">' . l::location() . '</td>
<td class="order_table_size">' . l::size1() . '</td>
<td class="order_table_date">' . l::fee_per_month() . '</td>
</tr>
';
foreach ($header as $z => $f) {
$page = $this->db->selectArray($this->db->Select('title_' . $lang, 'pages', "`id` = '" . $f['page_id'] . "'"));
$ret .= '<tr>
<td>' . $page['title_' . $lang] . '</td>
<td>' . $f['size'] . '</td>
';
if ($f['price' . '_header_' . $g['name']])
$ret .= '<td>$ ' . $f['price' . '_header_' . $g['name']] . '</td>';
else
$ret .= '<td></td>';
$ret .= '
</tr>';
}
$ret .= '
</table>
</div>
';
}
$ret .= '</div>';
$ret .= $contetn_bottom['content_' . $lang];
return $ret;
}
}
?>