In choices, there is also a option for "Others", if that clicks a textbox will appear and when un-checks that will disappear. Lets do the same with Javascript.

Put the following code on the header section


code:

function displayField(fieldID, display)
{
document.getElementById(fieldID).style.display = (display) ? 'inline' : 'none';

}



and the following in the body section.


code:

function displayField(fieldID, display)

<input name="checkbox_other" type="checkbox" class="text_background" id="checkbox_other" value="other" onclick="displayField('newClientLbl', this.checked)">
<label style="display:none" id="newClientLbl">

Enter Your Client Type: <input name="newClient" class="text_background" type="text">

Many CMS sites having a facility to show the latest topics on site. I have created a general function for get the top 'n' posts. It is in PHP with MySql.



code:



< ?php
function select_top($table, $fields, $key, $nos)
{
//done by : thecoderin.gmail.com
//date: 28 feb 2009

$count_field = count($fields);
$query = "SELECT ";
for($i=0; $i<$count_field -1; $i++) +++$query = $query."`".$fields[$i]."`, ";

$query = $query."`".$fields[$count_field -1]."` ";

$query .= "FROM $table ORDER BY $key DESC LIMIT $nos";
// echo $query;
$result = mysql_query($query);
return $result;
}
?>

Category : , | Read More...... edit post

PHP is a wonderful language which make anything possible in the web world. In some applications we need to generate a archive for binding a group of files.

Tar (tape archive), a file format (in the form of a type of archive bitstream) is going to generate. The tar format was created in early days of Unix and standardised by POSIX. So better you try it in a linux based system.

$file_path is the file/directory name you would like to archive
.



code:



<? php
$output_file = "TAR_FOLDER/".trim($ file_name) .".tar";
$cmd = "tar -cf ".trim($output_ file)." -C ".trim($file_ path)."
".trim($file_ name);
exec($cmd);

?>


Category : , | Read More...... edit post

Joomla is a php based open-source CMS toolkit. More you can find out from this document

Just follow the steps:

1.Create an article
2. Type some intro text, we need to put in the read more divider.
3.Click the Read More button at the bottom of the text editor.
4.Once you have the read more separation line, add some text beneath it.
5.Configuring the Article’s Parameters

Now that we have an article with intro text and main text, it needs to be configured so that it has permission to show the intro text to the public, but only displays the main text to users who have registered and logged in. On the right hand side of the Article Editor there are several parameter tabs. Under the first tab [Parameters – Article] there is an option labeled Access Level. By default it is set to public. Click the drop box and set it to Registered.

6. Click Save to save the article and exit to the Article Manager.

7. Select Main Menu From Menus tab.
8. Click on the Home Menu type
9. On Right Side
Parameters(Component)->Show Unauthorised Links; put the value as Yes.
10.Click on Save.

This article is for Joomla 1.5.x, you can if you want try it with older version, then please check this document

Category : , | Read More...... edit post

Here is links of some good Javascript reference books.

Single Page Reference

1. Javascript Quick Reference

2. Javascript Cheat Sheet

Books


3. Javascript: The Defenitive guide

4. Javascript By Example

Once my client asked me to do a validation for a form in which contains many check boxes. The form can submit the data if and only if at most 'm' number of check boxes are clicked. I have written a javascript function for that, so that it can re-use.


code:




function checkboxValidate(cform,max)
{
+++for (var c=0,d=0,e; e=cform[d]; d++)
++++{

+++++if (e.type=='checkbox' && e.name.match(/^show\[\]$/) && e.checked)
+++++++c++;
++++}
+++if (c > max)
+++{
++++alert('You can only click m checkboxes ');

+++++return false;
++++}
+++return true;
}




the function checkboxValidate takes two arguments

a.
cform - the name of the form, in which contains the checkboxes
b.
max - the allowed maximum number of checks.

You can edit this function and can enable it for the use of at least m number of clicks, that I left to you.

In many technical interviews, many of you face the same question as I did. After a long search and try I find out the exact query

It is just like this:



SELECT * FROM <tablename> ORDER BY <fieldname> desc limit <n-1>, 1;



Just check it with your table and comment your findings.

Category : | Read More...... edit post

Followers

FeedCount

Latest Posts

thecoderinc

Subscribe Now