The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/printthread.php 16 require_once



UserSpice
URL routing - Printable Version

+- UserSpice (https://userspice.com/forums)
+-- Forum: Miscellaneous (https://userspice.com/forums/forumdisplay.php?fid=28)
+--- Forum: Off-topic Discussions (https://userspice.com/forums/forumdisplay.php?fid=10)
+--- Thread: URL routing (/showthread.php?tid=977)



URL routing - brahm.pragya - 02-24-2018

Hello,
Is there any function in userspice for routing purpose?

For example if There is one file as test.php and my url like below:
http://localhost/userspice/users/test.php

I want to change this url pattern to the belo one
http://localhost/userspice/company/users/test.php

And the word company can be changed to company 1 or company 2 etc.





URL routing - Brandin - 02-24-2018

Hmmm, are you going to control them from the same Database? If so, you could just protect them deep level from z_us_root, otherwise the Redirect class wouldn't know what to do. You'd end up having to make your own function and replace class.

B.


URL routing - dan - 02-24-2018

What you're essentially thinking is how MVC (model, view controller works). We don't use that. I've thought about making an MVC version of userspice, but I think a lot of people like that it's NOT mvc.

There are ways to do this with an .htaccess file, but you would have to do a lot of tweaking.

The other option for when you get to a live server is to take two subdomains and point them to the same physical folder on your server and then store the company name you want to redirect them to would be in your users table for each user. Basically add a column called company or whatever to the users table.

Then, if your site was google.com you would do your links like

https://<?=$user->data()->company?>.google.com/users/test.php
Not the same as what you were asking, but a ton less fiddling. I do have an mvc controller for UserSpice but it's not ready, so that could work in the mean time.


URL routing - brahm.pragya - 02-26-2018

Thank you for your solutions.

Can I change my url after the users?
http://localhost/userspice/users/company/test.php

I tried to make folder inside the users folder but not working.