integrate_basic_url_replacement December 20, 2014, 06:10:25 am I find this inside Subs.php and I think this could be a useful hook for my subforum case. Can I have some samples on how to use this effectively?
Re: integrate_basic_url_replacement Reply #1 – December 25, 2014, 07:55:52 pm From what I can tell, all you have to do is to add your string that you want to search for in the $find array. Then add your corresponding string that you want to replace it with in the $replace array. Something basic like this. Been a long time since I wrote PHP so I'm not sure if the array merge will work exactly as I'm thinking. But this is the basic idea. array_push() might be better than array_merge. I'll leave that up to the professionals here to correct me. lol[php]function addCustomReplaceUrl(&$find, &$replace) { array_merge(array('{custom_name}), $find); array_merge(array($scripturl . '?action=customurl'), $replace);}[/php]Assuming you have the hook set to call your method, this should add your custom find/replace to the integration hook.
Re: integrate_basic_url_replacement Reply #2 – December 28, 2014, 01:31:13 am Thank you @IchBin. I will play with this integration more. Basically, I wish to change $boardurl from what is defined in Settings.php to this $boardurl = $parts['scheme'] .'://'. $_SERVER['SERVER_NAME'] .(!empty($parts['port']) ? ':'. $parts['port'] : '') . (!empty($parts['path']) ? $parts['path'] : ''); if subforums mod is set.
Re: integrate_basic_url_replacement Reply #3 – December 28, 2014, 06:27:59 am This function is intended to replace strings with urls in text. I don't think it's of any help in what you are doing.
Re: integrate_basic_url_replacement Reply #4 – January 05, 2015, 09:52:14 am I will have to find some other way to work the mod out. Thanks @emanuele.
Re: integrate_basic_url_replacement Reply #5 – January 05, 2015, 11:56:10 am I should really have a look at the code... but as usual I'd need days with 48 hours. LOL