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
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
URL routing
#1
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.


  Reply
#2
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.
  Reply
#3
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?>....s/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.
  Reply
#4
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.
  Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)