Answer the question
In order to leave comments, you need to log in
Cities in URL CodeIgniter how?
It is necessary that the site has a URL instead of site.ru /city/ moskva/kvartiry/sdam/ of the form: site.ru/moskva/kvartiry/sdam
All parameters must be "dynamic" in the address.
There is a City controller code below:
class City extends CI_Controller {
public function index($param1, $param2) {
if ($param1 == 'kvartiry') {
echo "страница квартир";
}
if ($param2 == 'sdam') {
echo "тип сделки: Сдача";
}
}
}
$route['(:any)'] = "city";
$route['(:any)'] = "city/$1";
Answer the question
In order to leave comments, you need to log in
Alternatively, you can specify the maximum number of parameters that will fall into the action of the controller
And process them as needed.
class Сity extends CI_Controller
{
public function index($city = 'msk', $object = '', $offer_type = '')
{
echo '<pre>' . var_export($city, true) . '</pre>';
echo '<pre>' . var_export($object, true) . '</pre>';
echo '<pre>' . var_export($offer_type, true) . '</pre>';
die;
}
}
<div class="wrapper">
<div class="item"></div>
<div class="item"></div>
</div>
.wrapper {
display: flex;
justify-content: space-evenly;
border: 1px solid black;
height: 200px;
}
.wrapper .item {
border: 1px solid black;
width: 40%;
height: 20%;
position: relative;
top: 70%;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question