e107help.org Q&A
0 like 0 dislike

To date almost everything that I've done with my site has ignored the object-orientated nature of e107. But now I'd like to instantiate an instance of the class 'core_user_url' (e107_core\url\user\url.php) so that I can reliably retrieve a path to login.php (it *looks* to me as though this class will do the job via its 'create' method).

Or perhaps there's a better way of doing this? I appreciate that the file name is unlikely to change, but I'd prefer not to use a string constant to reference it.

Thank you
e107 version Version 2.1.7 (git)
in Core by (78 points) 3 8 12
I suppose I should rephrase the question instead of trying to second-guess possible solutions:

How can retrieve the string "login.php" without hard-coding it?

2 Answers

1 like 0 dislike
Best answer

This should work

$url = e107::getUrl()->create('login');


For plugins, I recommend using 'e107::url()' as explained here: https://e107.org/developer-manual#urls

by (2.8k points) 7 10 10
selected by
0 like 0 dislike
Excellent! Thanks Moc
by (78 points) 3 8 12
Welcome to e107 Q&A, where you can ask questions and receive answers from other members of the e107 community.
966 questions
1,365 answers
2,437 users