route function for new custom pages
« on: December 28, 2022, 10:34:15 AM »
Hi ,

I want a little help to understand and work with the route function i found in the documentation

i have a custom page page-map.php

i add this line in the header.php       
Code: [Select]
osc_add_route('page_map','map_?/([0-9]+)', 'map/{cat}', '/delta/page-map.php');
and in the url of the previous page that redirect to page-map.php i put
Code: [Select]
<?php echo osc_route_url('page_map', array('cat' => 'Co-working'));
                        
?>

unfortunately doesn't work. Can you please help me on this ?

*

MB Themes

Re: route function for new custom pages
« Reply #1 on: December 28, 2022, 04:28:56 PM »
Try:
Code: [Select]
osc_add_route('page_map','map/(.+)', 'map/{cat}', '/delta/page-map.php');
But I am not sure if you can reference theme file in route.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

Re: route function for new custom pages
« Reply #2 on: December 28, 2022, 08:46:05 PM »
Thank you for replying

YES, we can apply route function to the custom pages, for me it worked perfectly

i add the ' _? ' and it worked

Code: [Select]
osc_add_route('page_map', 'map/(.+)', 'map_?/{cat}', 'public_html/oc-content/themes/delta/page-map.php');

*

MB Themes

Re: route function for new custom pages
« Reply #3 on: December 29, 2022, 12:03:54 PM »
Added _? for what purpose?
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

Re: route function for new custom pages
« Reply #4 on: December 30, 2022, 04:56:41 PM »
if im not added _? the page dosn't load im still try to figure out how to make it more accurate like https://mydomaine.com/map/CATEGOY/AREA

*

MB Themes

Re: route function for new custom pages
« Reply #5 on: December 30, 2022, 06:16:16 PM »
I think it somehow fake patterns/regex.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

Re: route function for new custom pages
« Reply #6 on: January 02, 2023, 10:40:31 AM »
Can you explain me this last answer pattern/regex