Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use a default category #219

Open
vincedchart opened this issue Sep 23, 2022 · 0 comments
Open

use a default category #219

vincedchart opened this issue Sep 23, 2022 · 0 comments

Comments

@vincedchart
Copy link

vincedchart commented Sep 23, 2022

Please help me hardcode variable category=35 by default using !isset

I need to hide all categories by default besides category 35.

here an example url point to category familie
https://nissennetz.de/galerie/osmmap.php?/category/familie&v=2

Thanks by avance

Relevant code from include/functions_map.php should be:

function osm_get_items($page)
{
// Limit search by category, by tag, by smartalbum
$LIMIT_SEARCH="";
$INNER_JOIN="";
if (isset($page['section']))
{
if ($page['section'] === 'categories' and isset($page['category']) and isset($page['category']['id']) )
{
$LIMIT_SEARCH = "FIND_IN_SET(".$page['category']['id'].", c.uppercats) AND ";
$INNER_JOIN = "INNER JOIN ".CATEGORIES_TABLE." AS c ON ic.category_id = c.id";
}
if ($page['section'] === 'tags' and isset($page['tags']) and isset($page['tags'][0]['id']) )
{
$items = get_image_ids_for_tags( array_reduce( $page['tags'], 'osm_get_page_tag_id' ) );
if ( !empty($items) )
{
$LIMIT_SEARCH = "ic.image_id IN (".implode(',', $items).") AND ";
}
}
if ($page['section'] === 'tags' and isset($page['category']) and isset($page['category']['id']) )
{
$LIMIT_SEARCH = "FIND_IN_SET(".$page['category']['id'].", c.uppercats) AND ";
$INNER_JOIN = "INNER JOIN ".CATEGORIES_TABLE." AS c ON ic.category_id = c.id";
}
}

$forbidden = get_sql_condition_FandF(
array
(
'forbidden_categories' => 'ic.category_id',
'visible_categories' => 'ic.category_id',
'visible_images' => 'i.id'
),
"\n AND"
);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant