ngduc / Thin-PHP-Framework

A micro web framework - lightweight and flexible open source PHP5 MVC framework
http://www.thinphp.com
Other
41 stars 17 forks source link

Subfolder & Alias path issue #6

Closed Nic0tiN closed 12 years ago

Nic0tiN commented 13 years ago

Hi, TPF is really interesting and I will spent more time on your product to track some bugs and improve some functionalities.

Actually, I'm trying to run the framework as an Alias (i.e. : http://localhost:8080/thinphp => home/www/devs/thinphpframework). But the paths don't follow correctly (i.e. CSS files missing). I tried to fix it by adding "RewriteBase /thinphp" in .htaccess, it doesn't work. I also tried to create a new constant which contain the full URI (http://localhost:8080/thinphp) and loading this constant in Smarty Templates using {$smarty.const.BASE_URI} it works but it's causing a malfunction for the forms validation (input button doesn't work as the AJAX is trying to load an unknown response file).

If you have any idea to solve this issue, I would appreciate :) and I think I'll not be the only one to do such thing ;)

BTW: I'm implemented gettext instead of using your translation system. I reckon PoEdit is a great tool if you need to translate your webapp in several languages. I will be pleased to send you my solution.

Test env.: Using WampSERVER 2.1 on Win7 Pro x64 PHP: 5.3.4 Apache: 2.2.17

irtusb commented 13 years ago

all the problems you found are result of the absolute path based form system.

davidyew commented 13 years ago

Hi Nic0tiN,

TPF is still budding... I really thank Duc Ng for creating it.

I am contributing to it whenever possible. On your query,

  1. URL Access

    I had yet tried it as a subfolder redirection. But you might want to set http://localhost:8080/thinphp as virtual directory so that the client may access it as thinphp:8080.

Then .htaccess add RewriteBase /"localhost_PATH"/thinphp

  1. Smarty Template Access By convention, all smarty template are found under BASE/app/view/en-default/. BASE is already defined by TPF as your root www PATH.

For AJAX, I presume you have a AJAX controller file under app/controller, then your ajax validation path in your smarty template file should direct as "/'Your ControllerName'".

TPF is superb powerful and scaleable with little overheads, thus you have FULL control on everything! :) The routing is SEF and SEO and also readable with little possibility to be hacked!

Duc and all, Note: on your .htaccess Add Options -Indexes to avoid unnecessary file listing in your directory. e.g: localhost/web, or localhost/web/css or localhost/js or localhost/img regards David Yew

On Sun, Aug 14, 2011 at 10:25 AM, Nic0tiN < reply@reply.github.com>wrote:

Hi, TPF is really interesting and I will spent more time on your product to track some bugs and improve some functionalities.

Actually, I'm trying to run the framework as an Alias (i.e. : http://localhost:8080/thinphp => home/www/devs/thinphpframework). But the paths don't follow correctly (i.e. CSS files missing). I tried to fix it by adding "RewriteBase /thinphp" in .htaccess, it doesn't work. I also tried to create a new constant which contain the full URI ( http://localhost:8080/thinphp) and loading this constant in Smarty Templates using {$smarty.const.BASE_URI} it works but it's causing a malfunction for the forms validation (input button doesn't work as the AJAX is trying to load an unknown response file).

If you have any idea to solve this issue, I would appreciate :) and I think I'll not be the only one to do such thing ;)

BTW: I'm implemented gettext instead of using your translation system. I reckon PoEdit is a great tool if you need to translate your webapp in several languages. I will be pleased to send you my solution.

Test env.: Using WampSERVER 2.1 on Win7 Pro x64 PHP: 5.3.4 Apache: 2.2.17

Reply to this email directly or view it on GitHub: https://github.com/ngduc/Thin-PHP-Framework/issues/6

ngduc commented 12 years ago

Unfortunately, TPF is not designed for Shared hosting (which has Relative paths) from the beginning. But Virtual servers are very cheap nowadays & TPF works well on them...

Nic0tiN commented 12 years ago

Thanks for your assistance :)