Answer the question
In order to leave comments, you need to log in
How to implement city selection on the site and display the desired content in DLE categories?
I'm trying to create in dle cms the ability to select a city with the display of the content of this city, which I did:
1. created an additional table in the database following the example of the existing one for categories (category) and named it city ; 2. added the city
field to the post table ;
3. filled in the fields city - id of cities from the city table in the test news;
that's all there was to it.
I tried to edit the engine/init.php file, a piece of code responsible for categories, edited it, added a copy of it but with 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 ();
}
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]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question