article

Thursday, April 28, 2011

Refresh a page in jQuery?

Refresh a page in jQuery?








<html>
<head>
<title>Refresh a page in jQuery</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
</head>
<body>
<a href="#" id="RefreshPage">Refresh Page in jQuery</a>
<script type="text/javascript">
$('#RefreshPage').click(function() {
location.reload();
});
</script>
</body>
</html>

Thursday, April 21, 2011

Joomla - add extra fields in joomla registration

Joomla - add extra fields in joomla registration

LIST OF FILES NEED TO EDIT

1. libraries\joomla\database\table\user.php
add two extra fields like phone and website, let’s these fields as optional
put the follow lines before above lines or near line 116

var $params = null;

var $phone = null;
var $website = null;
var $address = null;
/**
* @param database A database connector object
*/
function __construct( &$db )
{
2. add alter your user table
ALTER TABLE jos_users ADD phone varchar(255) DEFAULT '' AFTER password;
ALTER TABLE jos_users ADD website varchar(255) DEFAULT '' AFTER phone;


3. G
o to administrator\components\com_users\views\user\tmpl
open file form.php and put the following lines after line 132 … just add as new row in table




<tr>
<td width="150" class="key">
<label for="phone">
<?php echo JText::_( 'Phone' ); ?>
</label>
</td>
<td>
<input type="text" name="phone" id="phone" class="inputbox" size="40" value="<?php echo $this->user->get('phone'); ?>" />
</td>
</tr>
<tr><td width="150" class="key">
<label for="website">
<?php echo JText::_( 'Website' ); ?>
</label>
</td>
<td>
<input type="text" name="website" id="website" class="inputbox" size="40" value="<?php echo $this->user->get('website'); ?>" />
</td>
</tr>

4. Goto administrator->site->User Manager




















5. front end registration
components\com_user\views\register\tmpl\default.php for edit


<tr>

<td 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->escape($this->user->get( 'phone' ));?>" class="inputbox" maxlength="50" /> *
</td>
</tr>
<tr>
<td height="40">
<label id="websitemsg" for="website">
<?php echo JText::_( 'Website' ); ?>:
</label>
</td>
<td>
<input type="text" name="website" id="website" size="40" value="<?php echo $this->escape($this->user->get( 'website' ));?>" class="inputbox" maxlength="50" /> *
</td>
</tr>






Copy that default.php file from components\com_user\views\register\tmpl and now go to your current template folder. copy all the php files from components\com_user\views\register\tmpl to templates\{your custom template name here}\html\com_user\register

Wednesday, April 13, 2011

Jquery Ajax Requests submit loading Image

Jquery Ajax Requests submit loading Image

show a loading image when an AJAX request



<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#loading')
.hide()
.ajaxStart(function() {
$(this).show();
})
.ajaxStop(function() {
$(this).hide();
});
$('#submit').click(function() {
$('.test_content').load('load_content.php');
return false;
});
});
</script>
<h4>Jquery Ajax Requests submit loading Image </h4>
<div class='test_content'></div>
<p><a id="submit" href="#">Submit</a></p>

<div id="loading">
<img src="ajax-loader.gif" />
</div>


//load_content.php
<?php
sleep(4);

echo '

This content was loaded from a PHP script.

';

?>

Related Post