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)
asked in Core by (55 points) 1 6 10
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

answered by (2.4k points) 6 10 18
selected by
0 like 0 dislike
Excellent! Thanks Moc
answered by (55 points) 1 6 10
Welcome to e107 Q&A, where you can ask questions and receive answers from other members of the e107 community.
759 questions
1,169 answers
1,387 users