Chrisj Posted November 2, 2021 Share Posted November 2, 2021 The web video script that I'm trying to modify, successfully filters videos by category and by sub-category. The file code here shows sub-category related code: https://pastebin.com/zgbELKJf on lines 149 and 215 I am trying to display a search form when sub-category page appears, so I first need to determine if this code is the file that outputs the subcategory pages. (as a first step in being able to search the sub-category page by keyword). If this provides a clue, when I remove these lines: $pt->show_sub = false; $pt->sub_categories_array = array(); foreach ($pt->sub_categories as $cat_key => $subs) { $pt->sub_categories_array["'".$cat_key."'"] = '<option value="">'.$lang->all.'</option>'; foreach ($subs as $sub_key => $sub_value) { $pt->sub_categories_array["'".$cat_key."'"] .= '<option value="'.array_keys($sub_value)[0].'" '.((!empty($_GET['sub_id']) && $_GET['sub_id'] == array_keys($sub_value)[0]) ? "selected" : "") .'>'.$sub_value[array_keys($sub_value)[0]].'</option>'; } if (!empty($_GET['id']) && $_GET['id'] == $cat_key) { $pt->show_sub = true; if($pt->show_sub) { } } it eliminates the drop-down list to choose a subcategory, so there’s no way to display subcategory pages without that code. And on the html page file there is also this code: <?php if ($pt->page == 'category' && $pt->show_sub == true) { ?> <script type="text/javascript"> $(document).on('change', '#category_id', function(event) { event.preventDefault(); id = $(this).val(); $('#sub_category_id').html(sub_categories_array["'"+id+"'"]); }); $(document).on('change','#sub_categories_', function(event) { window.location.href = site_url+'/videos/category/<?php echo($_GET['id']) ?>/'+$('#sub_categories_').val(); }); </script> Any additional assistance is welcomed Quote Link to comment https://forums.phpfreaks.com/topic/314156-help-with-determining-if-file-outputs-subcategory/ Share on other sites More sharing options...
requinix Posted November 2, 2021 Share Posted November 2, 2021 And what's the question? Best I can tell, you're asking for help trying to find out what code does. Quote Link to comment https://forums.phpfreaks.com/topic/314156-help-with-determining-if-file-outputs-subcategory/#findComment-1591680 Share on other sites More sharing options...
Chrisj Posted November 2, 2021 Author Share Posted November 2, 2021 (edited) Thanks for your reply. I'm trying to get help to determine if the php file outputs the subcategory. And then I'll be looking for guidance to ultimately have a search form appear on the page when it's a subcategory page. I had tried echo-ing the Form onto the sub-category page by adding to the php file ( https://pastebin.com/zgbELKJf ) this: $injectForm = ""; - - -etc.- - - $injectForm = "<form action=\"content.php\" method=\"GET\" id=\"sub-search\"> <input id=\"search\" name=\"keywords\" type=\"text\" placeholder=\"Type here\"> <input type=\"submit\" value=\"Search\" /> </form>"; and added this to the html page: <?php echo $injectForm; ?> but no success with displaying the Search Form onto a subcategory page Edited November 2, 2021 by Chrisj Quote Link to comment https://forums.phpfreaks.com/topic/314156-help-with-determining-if-file-outputs-subcategory/#findComment-1591681 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.