- Uncategorized
- Joomla! 1.5
- CSS
- Eclipse
- PHP
- WordPress
- Illustrator
- SVN
- Mootools
- JavaScript
- Ubuntu
- Joomla! 1.0
- Regex
- SEO
- Plesk/Virtuozzo
- Joomla! 1.7
- Joomla! 1.6
- Apache
- WAMP
- Magento
- CURL
- SQL
- Joomla 2.5
- Netbeans
- GIT
- mySQL
-
Installing Magento via SSH With The Full Download
Following code used version 1.6.0.0, make sure to change the version number if you want to install a different version number:
To delete magento folder and tar file: Read More... -
A basic Joomla 1.5 CSS file
Following are the classes used in Joomla 1.5 template CSS.
Read More... -
A basic Joomla 1.5 template xml file
New Joomla template developers know every time when they start a template they need to write all the xml from scratch. Well here is a very basic xml file that can be used as start or reference.
Read More... -
A function to generate unique id's and keys
Following function will generate id's/keys without using MD5 or SHA1.
PHP function uniqid() to generate Unique ID's. It will create prefixed unique identifier based on current time in microseconds. This function will return (13 + prefix length) characters long identifier. If 'lcg' is true then it will return (prefix length + 23) characters. This function will generate shorter strings than md5(), which will also save you some space. Syntax: string uniqid ( string prefix [, bool lcg]) Make guessing very difficult: To reduce the chances of getting a duplicate, you can pass a prefix, or the second parameter to increase entropy: MD5 Function to generate Unique ID's Can also use md5() function for this, even though it's not exactly meant for this purpose: Read More... -
Arbitrary Number of Arguments in a Function
How to create a function that accepts any number of arguments? We can use func_get_args. It returns an array comprising a function's argument list. // note empty argument list function foo() { // func_get_args will return an array of all passed arguments $args = func_get_args(); // Now we can loop through array and find arguments foreach ($args as $k => $v) { echo "arg".($k+1).": $v\n"; } } // Now lets see what outputs we get foo(); /* prints nothing */ foo('hello'); // prints arg1: hello foo('hello', 'world', 'again'); // prints arg1: hello, arg2: world, arg3: again
Read More... -
Art Board and Crop in Illustrator
In your Illustrator print settings there is an option under 'Setup' to crop the print to the: Artboard, Artwork Bounding Box (basically everything in the file) or a specified 'Crop Area'. If you want to crop everything in your artboard do following: You can just mask out everything by making a box the size of the artboard and putting it at the top, selecting all and then doing a CMD+7 to crop it.
Read More... -
Auto Loading classes in Joomla
If you use JLoader to load classes, Joomla will store list of class names and their corresponding files. This way it will automate the registration of classes if there are multiple classes.
Following makes a list of all files in /classes and registers them with JLoader. {/codecitation} Example 6: $classpath = dirname(__FILE__).DS.'classes'; foreach( JFolder::files($classpath) as $file ) { JLoader::register(JFile::stripExt($file),$classpath.DS.$file); } {/codecitation} Read More... -
Breezing form data vairiables
Joomla's Breezing Form data variables:
Read More... -
Cake PHP .ctp files syntax highlighting in Netbeans
Netbeans by default does not detect or highlight Cake PHP ctp files. .ctp files are cakephp files which is similar to .php files but with the file extension of .ctp. To enable syntax highlighting for Cake PHP files you can go to Tools > Options > Miscellaneous > Files Then click on new button next to File Extension field. Enter ctp in popup box for New File Extension Press on and then select PHP Files (text/x0php5) in Associated File Type field. Press OK. Now go to your Netbeans and close and open file again. It should have the correct syntax highlighting. Same steps could be used to associated other types of file extensions for PHP, JavaScript etc.
Read More... -
Calling a plugin from a Component or another Plugin
You can use a plugins functions from another plugin or component using following codes. These are for Joomla 1.5
OR Read More... -
Calling plugin method inside custom component in Joomla 1.7
You can call a plugin method inside a component and pass it data.
You can have all your custom plugin in a group and give it a name for example "myplugins". All the component needs to do is invoke the plugin, pass data and handle response. Read More... -
Checking view permissions
To check view permissions, you have to check whether the "access" field is within the viewing access levels for which the user is allowed to see.
via query: Read More... -
chmod directories/files using command line
Read More... -
Create New user in Joomla
Implementation Read More... -
Creating zip archives in PHP
PHP comes with a ZipArchive class that lets us create and manipulate .zip files.
Creating a Zip file using PHP
Following code will create master.zip with files containing master.css, new.css, layout.cssExtracting a Zip file using PHP
Read More... -
CSS Classes to input tags
Input elements can be targeted by assigning tags to the same input types. It is possible that we want to style input elements as text input fields, text areas and select boxes to have different widths while button input elements to have a different style.
Can also use multiple classes: Now using following in css we can target each type separately. [css]input[type="button"] { border:2px solid #ccc; padding:3px}[/css] Read More... -
CSS with PHP using PHP variables
Recently one of my client asked me to add the functionality for users of their custom Content Management System(CMS) to give them more control over layouts etc. Using CSS in PHP makes it really easy to have styling flexibility. Following steps are involved to write CSS via PHP. Create CSS file as a PHP file Set its content type using the following code
Create PHP variables as you would normally in other PHP code. You can also bring variable data from database etc. Outside your PHP tags you can write all of normal CSS code. Where ever you need to write the variable value just echo that variable not PHP way. [css]#myLeftCol {height:; color:;}[/css] Final Code for stylesheet.php: Read More... -
CURLOPT_FOLLOWLOCATION warning message
While developing a twitter extension I came across following warning message on my Ubuntu development server.
After doing some research I found that curl follow location option tells curl to follow a redirect header or not. If the environment in the php.ini is running php in safe mode or an open base dir is set, the CURLOPT_FOLLOWLOCATION will end up raising a warning message on the page. Solution: Read More... -
Custom parameter optgroup for Joomla 1.5
In this post we will walk you through the steps on how to create a custom parameter for Joomla 1.5 websites. The parameter we will create will be optgroup that shows as a dropdown box with groups of select options separated with headings.
Read More...
-
Exlude/Separate SVN folders
Subversion created hidden .svn folders in all the directories to keep track of changes. These folders can become a headache when it comes to copy a project from one directory to another. These folders can also become a security issue. There are many ways solve this problem. 1. Use export feature of Eclipse and it will not export any of the .svn folders. 2. Use copy commands on Win or Linux
3. Robocopy 4. Ignore files and folders from repository Read More... -
Finding Domain Name from URL in PHP
Following are various functions to find domain name in URL using PHP.
Regex Method: Read More... -
Go Back button with Javascript
JavaScript: Use inline JavaScript to send user back to previous page.
Can also send user two steps back as well. PHP: PHP code to send user back. Read More... -
GPL issues for Joomla extensions
GPL guidelines for submitting extensions to Joomla Extensions Directory(JED). 1- PHP files: 1A- Notice at the top of each php file stating that it is distributed under the terms of the GPL (see http://www.fsf.org/licensing/licenses/gpl-howto.html for details) 1B- Copyright notice at the top of each php file, as in:
2- XML File 2A- atag in your extension's XML file stating that it is GPL, as in: [xml]<license>GNU/GPL http://www.gnu.org/copyleft/gpl.html</license>[/xml] 2B- a copy of the GPL license with your package (note: this does not need to be installed with the extension, just included with the package as a text file) Read More... -
Hide .svn folders from Appache
Use following directive in our httpd.conf to prevent Apache from descending into .svn folders.
Read More... -
How to calculate distance between two locations
A very useful function that can be used to calculate distance between two points using latitude and longitude values. $unit parameter can be passed to get return in miles, kilometers, or nautical miles.
How to use: Another function: Read More...











































