0vote

Instantiate instance of core_user_url class

Hello,

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)

sBwMikael commented Jan 19

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

1vote

Moc Points2266

This should work

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

 

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

0vote

sBwMikael Points55
Excellent! Thanks Moc

Please log in or register to answer this question.

Know someone who can answer? Share a link to this

...

e107 Q&A is a Question and Answer platform where e107 users can ask questions themselves and answer each others questions. By doing so users can earn badges and points and become e107 experts.

This community platform is a valuable tool for sharing and gaining knowledge on e107. Go ahead and find out yourself!

Connect with us