Load data from CSV to MySql

Open the command prompt. Run the below command

LOAD DATA LOCAL INFILE ‘filepath’ INTO TABLE tablename FIELDS TERMINATED BY ‘,’ ENCLOSED BY ‘”‘ ESCAPED BY ‘\\’ LINES TERMINATED BY ‘\r\n’;

filepath – path of the csv file

tablename – mention the table name

Meta tag generator in Joomla 1.5

Q.  how i can remove the:
<meta name=”generator” content=”Joomla! 1.5 – Open Source Content Management” /> From all pages or atlest know how to change it to something else.A.

The text is located at or around line 85 in document.php.
The route to the file libraries/joomla/document/document.php
Q. How can i pass the static Meta tag in Joomla 1.5?
A.
n the index.php file of your template in the head section just add this
<?php $this->setGenerator(‘ ‘); ?>

Geo-location Identifier

Now it easy to identify where user accessing your website. You can store the location, state and country. Here i’m giving the code to just show all there parameters. How you need customize.

Step1: Create the geonames.php

<?php
	session_start();

if ($_GET['type'] == 'JSON') {
     CURL_file_get_contents('http://ws.geonames.org/findNearbyPlaceNameJSON?lat='.$_GET['lat'].'&lng='.$_GET['lon']);
}

if ($_GET['type'] == 'XML') {
   CURL_file_get_contents('http://ws.geonames.org/findNearbyPlaceName?lat='.$_GET['lat'].'&lng='.$_GET['lon']);
}

function CURL_file_get_contents( $url ){
          $open_file = curl_init();
            // Tell CURL the url to open.
          curl_setopt($open_file, CURLOPT_URL, $url);
            // Tell CURL to return the file in a string.
          curl_setopt($open_file, CURLOPT_RETURNTRANSFER, 1);
            // Execute the CURL command and retrun the page in a string.
          $return_var = curl_exec($open_file);
          curl_close($open_file);         
  		 $abc = json_decode( $return_var);	  
		 $_SESSION['cityname'] 		= $abc->geonames[0]->name;
	     $_SESSION['state'] 		= $abc->geonames[0]->adminName1;
		 $_SESSION['countryName'] 	= $abc->geonames[0]->countryName;
		 echo $return_var;	 

}
?>

Step2: Create index.php (or) where you need to show the user location details place the code there.

Place this code before </head>

 <script type="text/javascript">

        function main() {

            // Check for geoLocation Support
            if (navigator.geolocation) {
                // YES                                                      
                // snapshot of position: 
                //navigator.geolocation.getCurrentPosition(renderPosition, renderError);
                // updating position:
                navigator.geolocation.watchPosition(renderPosition, renderError);
            } else {
                // NO
                $('#geoResults').html('<p>Your browser does not support geolocation.</p>');
            }
        }

        //jQuery to render the output
        function renderPosition(position) {

            if (!window.count) window.count = 0;
            var urlJSON ='';

            count ++;
            // var urlJSON = 'http://ws.geonames.org/findNearbyPlaceNameJSON?lat=-36.9104718&lng=174.9133483';
            var urlJSON = 'http://websitename.com/geonames.php?type=JSON&lat='+position.coords.latitude+'&lon='+position.coords.longitude;
            var urlXML  = 'http://websitename.com/geonames.php?type=XML&lat=' +position.coords.latitude+'&lon='+position.coords.longitude;

            // now get the XML reverse geo data
            $.getJSON(urlJSON, function(json) {

                /* Parse JSON objects */
                $.each(json.geonames,function(i,item) {
                    // get the name - which is the suburb - and update the page
                    $('#jsonResults').html('<p>You live in: ' + item.name + ' '+ item.adminName1 +' '+ item.countryName+'</p>');
                });

            });
        }

        function renderError() {
            $('#georesults').html('<p>The page could not get your location.</p>');
        }

    </script>

Place this div where you want to show the details

 <div id=”jsonResults”>your location</div>

Jumi Extension – custom code extensions for Joomla! 1.0.x, 1.5.x and 1.6.x

Jumi is the set of custom code extensions for Joomla! 1.0.x, 1.5.x and 1.6.x in their native modes.
With Jumi
* you can include php, html, javascript scripts into the modules position, articles, category or section descriptions, or into your own custom made component pages,
* you can even include static html or txt pages into your pages without using wrapper component,
* you have full access to Joomla! variables, functions, constants, etc. in your php scripts.

Jumi is ideal solution for
* including banners or text ads into your Joomla! site: no matter if your own or affiliates ones,
* easy and fast inclusion of smart javascript, php, html and dhtml scripts into your Joomla! content,
* fast development of not only small and simple customized modules and plugin solutions based on php, javascript and html or dhtml scripts like flash shows, ads and picture presentations, forms inclusion, etc. But for the development of more sophisticated solutions including database data processing.

For Jumi tips and tricks visit dedicated Tips & Tricks Jumi pages at http://edo.webmaster.am/jumi/tutorial

Fix in 2.0.5: security vulnerability of the component.
Fix in 2.0.6: link changes

New in 2.0 (for J1.0 and J1.5): +component, + router (J1.5 only), +languages, +storage of custom code into a database table too, integration of all Jumi extensions.

Fix in 2.1.0 beta3: security vulnerability of the component.

New in 2.1 (still beta): direct code including into Joomla! content, pdf rendering, clearing the code from RSS feeds, security filtering option, debug mode in a plugin and a module, etc., etc.

New version for J!1.6 is ready. There is a problem with the module, so Jumi plugin is converted from Content to System, so you can place jumi syntax wherever you want in the site. There are also problems with the i18n, probably it is an issue in the core.

If you find issues, please report them: http://code.google.com/p/jumi/issues/list

NOTE: You can install 2.0.6 version on top of the previous version, without uninstalling it.

Adding Additional Field To The Joomla 1.5 Registration Form

Warning: Joomla Hack! The following code involves modifying the core Joomla code. This has intrinisc drawbacks, i.e. any time you upgrade you’ll have to redo the code, or lose this functionality

The Joomla Registration page usually contains enough information for most website. Users who want enhanced user information, typically go for Community Builder which allows extensive user registration fields. However, it is entirely possible to create additional registration fields without installing any components, by modifying a few lines in the Joomla core code. Here’s how to do it.

In this example, we will be adding Business and Phone to the user registration field, however you can modify the example to add any fields you want to.

Step 1 – Add fields to the Users table
The first thing you need to do is to add the new fields into the Users table into the database. Using phpmyadmin or otherwise add the fields to the users tabl. The following SQL command adds the fields, however you can add these in any way you want:

ALTER TABLE jos_users ADD business VARCHAR (100) NO NULL AFTER name;
and
ALTER TABLE jos_users ADD phone VARCHAR (100) NO NULL AFTER business;

Once you have created the columns, verify that they have been created correctly and move on to the next step.

Step 2 – Modify the code
You’ll need to modify a total of 4 files:

1. Modify the user class to include the new files in libraries/joomla/database/table/user.php

var $name = null;
/**
* The login name
*
* @var string
*/

var $username = null;

var $business = null;
var $phone = null;

2. Modify the code which displays the registration page components/com_user/views/register/tmpl/default.php

<tr>
<td width=”30%” height=”40″>
<label id=”namemsg” for=”name”><?php echo JText::_( ‘Name’ ); ?>: </label> </td>
<td>
<input type=”text” name=”name” id=”name” size=”40″ value=”<?php echo $this->user->get( ‘name’ );?>” maxlength=”50″ /> * </td>
</tr>

<tr>
<td width=”30%” height=”40″>
<label id=”businessmsg” for=”business”><?php echo JText::_( ‘Business’ ); ?>: </label> </td>
<td>
<input type=”text” name=”business” id=”business” size=”40″ value=”<?php echo $this->user->get( ‘business’ );?>” maxlength=”50″ /> * </td>
</tr>
<tr>
<td width=”30%” height=”40″>
<label id=”phonemsg” for=”phone”><?php echo JText::_( ‘Phone’ ); ?>: </label> </td>
<td>
<input type=”text” name=”phone” id=”phone” size=”40″ value=”<?php echo $this->user->get( ‘phone’ );?>” maxlength=”50″ /> * </td>
</tr>

3. Modify the view of the users list: components/com_user/views/user/tmpl/form.php

<tr>

<td width=”120″>
<label for=”name”>
<?php echo JText::_( ‘Your Name’ ); ?>:
</label>
</td>
<td>
<input type=”text” id=”name” name=”name” value=”<?php echo $this->user->get(‘name’);?>” size=”40″ />
</td>
</tr>
<tr>

<td width=”120″>
<label for=”business”>
<?php echo JText::_( ‘Business’ ); ?>:
</label>
</td>
<td>
<input type=”text” id=”business” name=”business” value=”<?php echo $this->user->get(‘business’);?>” size=”40″ />
</td>
</tr>
<tr>
<td width=”120″>
<label for=”phone”>
<?php echo JText::_( ‘Phone’ ); ?>:
</label>
</td>
<td>
<input type=”text” id=”phone” name=”phone” value=”<?php echo $this->user->get(‘phone’);?>” size=”40″ />
</td>
</tr>

4. Edit the page which displays the users in the backend: administrator\components\com_users\views\user\tmpl\form.php

<tr>
<td>
<label for=”email”>
<?php echo JText::_( ‘Email’ ); ?>
</label>
</td>
<td>
<input type=”text” name=”email” id=”email” size=”40″ value=”<?php echo $this->user->get(’email’); ?>” />
</td>
</tr>

<tr>
<td>
<label for=”business”>
<?php echo JText::_( ‘Business’ ); ?>
</label>
</td>
<td>
<input type=”text” name=”business” id=”business” size=”40″ value=”<?php echo $this->user->get(‘business’); ?>” />
</td>
</tr>
<tr>
<td>
<label for=”phone”>
<?php echo JText::_( ‘Phone’ ); ?>
</label>
</td>
<td>
<input type=”text” name=”phone” id=”phone” size=”40″ value=”<?php echo $this->user->get(‘phone’); ?>” />
</td>
</tr>

That’s it! You now have a couple of additional fields in the users table, and more information available to use