Category: php
-
Joomla: How to check if the current page is Home Page or not in Joomla
Joomla is a best custom management open source tool. It provides many type of functionality regarding theme, module and components. During development time we need to create some special function to use on home page only. or we can say that sometimes we want to show something (content) on the home page only. Joomla says…
-
PHP Motion: Captcha code is not working
When you install the phpmotion on your system you will find that captcha code is not showing on registration page. open includes/captcha.php and replace var $font = ‘DoradoHeadline.ttf’; by var $font = ‘./DoradoHeadline.ttf’; Tweet This Post
-
Joomla: $this->baseurl is not working in custom template module
Joomla provides some basic themes which are already installed in the templates folder. When any developer develop the CMS in the joomla , he use his own template with new design. On the index page $this->baseurl works well but when he want to own module then he create a folder in custom template folder. But…
-
PHP: Regular expression to make linkable url in string
Are you looking for a regular expression to make clickable url in the string? Yes!, you will get your solutions here: echo preg_replace(“/http\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/”, “$0”, $string); If you want to open url in new tab then : echo preg_replace(“/http\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/”, “$0”, $string); Tweet This Post
-
Ajax: Upload a file through ajax ( without page refresh)
In most cases we need to upload something on server without refreshing the page. for example we want to upload an image from popup window. But it will refresh the page and we will lost our popup and its content… so for this type of problems we providing an attractive code for upload a files…
-
Write the text on image using GD Library
What is the GD library? GD is an open source code library for the dynamic creation of images by programmers. GD is written in C, and “wrappers” are available for Perl, PHP and other languages. GD creates PNG, JPEG and GIF images, among other formats. GD is commonly used to generate charts, graphics, thumbnails, and…
-
How to find Server time in magento
Many times developer gets the time problem during project development. Because he works on date function which provides by PHP but site works on different server which time is different from developer country. So for this case you can use magento time which priovides by Magento self. It Manage the server time. This line will…
-
Translate english to hindi by google api
Sometimes we need to develop a website with Hindi font. But main problem is how to insert content in Hindi in admin panel. so here is a solution by this admin can enter content in Hindi font. It will work like: When admin type any word like ‘welcm‘ and then type space it will automatically…
-
Magento : add two column value in collection
many times we need to do operation on two column values and show in the admin panel. for this we have to follow these steps: 1. Add column in your Grid.php file: 2. Now create a folder in the AdminHtml folder with name ‘Renderer’ 3. Create a new php file with name ‘Qty.php’ 4. Write…
-
WordPress: Retrieve all roles list
Many times we need to show all roles in a dropdown for our widget and we try to find in database but we are unable to get correct value.. so here I am providing a good solution to get all list of roles: Tweet This Post
-
Remove side space in string
Javascript Trim Functions Use the code below to make trim a method of all Strings. These are useful to place in a global Javascript file included by all your pages. String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g,””); } String.prototype.ltrim = function() { return this.replace(/^\s+/,””); } String.prototype.rtrim = function() { return this.replace(/\s+$/,””); } // example of using…
-
Product Thumbnail sizes in Magento
If you want to show product thumbnail on any page in your requirement size then At the showing page : <img src=”<?php echo $this->helper(‘catalog/image’)->init($_product, ‘small_image’)->resize(100, 100) ?>” border=”0″ alt=”<?php echo $this->htmlEscape($_product->getName()) ?>” /> Change 100, 100 to your X, Y Where X : your requirement width and Y : Requirement height. Tweet This Post
-
Create multilanguage site
To create a site in multiple languages you should do two main things : Write this code after connection created in database file : mysql_query ( ‘SET character_set_connection=utf8, character_set_results=utf8, character_set_client=binary;’, $connectionID ); And write below code in common file which use in complete site : header(‘Content-Type: text/html; charset=ISO-8859-1’); Tweet This Post