How to implement the choice city on the website and display the desired content in the categories of DLE?

Trying to create a dle cms a choice of city with the display of content on the city that has made:
1. created an additional table in the database according to the example of the existing categories (category) and called it the city;
2. in the table posts (post) added the field, city;
3. in the test the news filled the city field - id of cities table city;
it was all up.

Tried to edit the file engine/init.php the piece of code responsible for a category, edited it, added a copy of it but with the settings for city

$cat_info = get_vars ( "category" );

if (!is_array ( $cat_info )) {
 $cat_info = array ();

 $db->query ( "SELECT * FROM" . PREFIX . "_category ORDER BY posi ASC" );
 while ( $row = $db->get_row () ) {

 $cat_info[$row['id']] = array ();

 foreach ( $row as $key => $value ) {
 $cat_info[$row['id']][$key] = stripslashes ( $value );
}

 $cat_info[$row['id']]['newscount'] = 0;

}
 set_vars ( "category", $cat_info );
 $db->free ();
}


rules .htaccess but eventually got something working but not completely, the max I was able to access the city, for example, site.ru/moscow/ and see the title, description, breadcrumbs for Moscow, but the categories would be displayed based on the id of the city.
Ie, if the city database city - id equal to 7, the site for the city of Moscow displays news from category with id 7, but should show all existing news - categories but with the news of Moscow.

In .htaccess rules line


RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^.]+)/page/([0-9]+)(/?)+$ index.php?do=cat&category=$1&cstart=$2 [L]
RewriteRule ^([^.]+)/?$ index.php?do=cat&category=$1 [L]


as well added their own counterparts.

Doing something wrong and know it, but I do not understand...
Help to understand, please.

I need to select city Moscow site.ru/moscow/ display the page with the usual list of news and categories but with the news of the city of Moscow.

Categories in the form site.ru/moscow/category
site.ru/moscow/category2 etc.

Thank you!
April 7th 20 at 10:40
0 answer

Find more questions by tags PHPMySQLDLE