In: JavaScript
23 Sep 2010Tweet It could be useful to get current page URL and current page title. Especially if we want to make sharing plugin for our website. Often, we need that information in order to pass them as a parameter to sharing services like Twitter, Delicious, Facebook, etc… So, in order to get these information, you can [...]
In: PHP
6 Sep 2010Tweet Very often we have a situation where we need to change users address back, from where he came. It is mostly used on pages where user should login or register. To get him back we could send previous URL as parameter in login or registration form. Add this code inside your form to send [...]
In: .htaccess
16 Aug 2010Tweet In order to have nice URLs you could use various techniques. But in case you have a really simple website with pages written in PHP, and URLs pointing to those PHP files like www.example.com/my-page.php, you could set nice URLs using .htaccess only. Using following snippet will let you have URLs like www.example.com/my-page, and still [...]
In: PHP
30 Jul 2010Tweet Very often you need to know exact URL of your current page. To get URL of current page, you should just implement following function and apply it, as shown in example below. 1 2 3 4 5 6 function get_URL() { $s = empty($_SERVER["HTTPS"]) ? ” : ($_SERVER["HTTPS"] == "on") ? "s" : ""; [...]
Tweet To build URL with Zend Framework, you should use: echo $this->url(array $urlOptions = array(), $name = null, $reset = false, $encode = true); so, in order to use Zend URL, use following: echo $this->url(array(’module’ => ‘moduleName’, ‘controller’ => ‘controllerName’, ‘action’ => ‘actionName’), null, true);
In: .htaccess
28 Jun 2010Tweet In order to remove double or multiple slash from your URL using only .htaccess you can use following code: 1 2 RewriteCond %{REQUEST_URI} ^(.*)//(.*)$ RewriteRule . %1/%2 [R=301,L]