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



UserSpice
Better solution to find init - 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: Better solution to find init (/showthread.php?tid=718)



Better solution to find init - Brandin - 09-03-2017

So my biggest problem is calling init from different directories (in particular, my userpost.php file inside of /templates/)

I currently call using:
require_once $_SERVER['DOCUMENT_ROOT'] .'/mydash/users/init.php';

But if I move this to my prod server, I lose the /mydash/ dir - which means this function breaks

Thoughts?


Better solution to find init - mudmin - 09-04-2017


That's the problem. init.php and z_us_root.php act like a magical pair of planets orbiting each other. Before we did it this way, you had to define your site's root in the init.php file itself and it caused all sorts of problems.

In fact, userspice is the only php app I've ever used that you can just move wherever and as long as the db credentials are intact, everything just works. Try doing that with joomla or wordpress.

So, what is the problem calling init from different places.

It should be a matter of just doing '../users/init.php' to back up one folder or ../../users.init.php to back up two.

Basically the question is how many folders deep is that templates folder and you need one set of ../ to back up and get to it. Or you can use your full domain. https://mydomain.com/users/init.php