rash805115 / rnj

Online Shopping Portal
2 stars 3 forks source link

Avoiding full URLs #17

Open shivamdixit opened 11 years ago

shivamdixit commented 11 years ago

In updateaccount.php, full absolute URLs like :

http://localhost/rnj/framework/file/js/jquery.js

are used, which can create huge problem at later stages when the code will have to run on different machines since the URL will NOT be same on each machine. Changing it in every file will waste time . Instead we should implement a function like site_url , which will return the present base URL (example http://localhost/rnj/) and we will simply append our relative URL (i.e framework/file/js/jquery.js). It will make code compatible with different machines.

rash805115 commented 11 years ago

There is the same function as you said in the HTTP Library...for now I have done it for the implementation purpose. I am aware of this task and will change them as soon as I can get time. In the controllers, /control/user/ you can see many example of those. If you want, you can also change them by looking at those examples.

On Sun, Oct 27, 2013 at 4:52 PM, Shivam Dixit notifications@github.comwrote:

In updateaccount.php, full absolute URLs like :

http://localhost/rnj/framework/file/js/jquery.js

are used, which can create huge problem at later stages when the code will have to run on different machines since the URL will not be same on each machine. Changing it in every file will waste time . Instead we should implement a function like site_url , which will return the present base URL (example http://localhost/rnj/) and we will simply append our relative URL (i.e framework/file/js/jquery.js). It will make code compatible with different machines.

— Reply to this email directly or view it on GitHubhttps://github.com/rash805115/rnj/issues/17 .

Regards, Rahul Chaudhary Ph - 412-519-9634

shivamdixit commented 10 years ago

In HTTP Library there is a static protected property $BaseURL of HTTPRequest class. Also, there is a method SetBaseURL but I can't find anything like GetBaseURL. How can I access this protected property from the view/controller ?

Instead of \phpsec\HttpRequest::Protocol() . "://" . \phpsec\HttpRequest::Host() . \phpsec\HttpRequest::PortReadable() . "/rnj/framework

Let's have one function GetBaseURL ?