Open Classifieds 1.6 Released

The latest version of Open Classifieds 1.5.4 was released  the 8th of December. Two months later and with more than 11.100 downloads, I’m proud to release 1.6.

I started working on 1.6 at the ends of 2009 and before the release of today we had two release candidates: RC 1, RC 2. Also I installed RC 2 successfully  in a few web sites.

In the upcoming dates we will update all the site FAQs but we already have the forum and the demo running.

What’s new
Just a briefing of what’s new:

  • Using Db class phpMyDb
  • Prefix for DB tables
  • Advanced search
  • Settings, everything from config.php in a simple form
  • Now templates can have their own index (listing) and template for items
  • New themes
  • New Languages
  • Check more in readme.txt

Download 1.6 now!

How to upgrade from previous versions:

  • Make a backup of your files and DB, just in case
  • Erase the files form your FTP (NOT the folder /images/)
  • Upload the new files
  • Run http://yoursite.com/install/
  • Done

c&p from Open Classifieds blog

Allow only numbers or letters in HTML inputs

What about forcing the user to type a number/letter in the input you want.

With just a bit of JavaScript we can control this what is the user typing int he input.

Allow only numbers:
(also dot and del)

function isNumberKey(evt){
	var charCode = (evt.which) ? evt.which : event.keyCode;
 
	if((charCode==46||charCode==8||charCode==45||charCode==47) ||(charCode >= 48 && charCode <= 57) ){
		return true;
	}
	else {
		return false;
	}		
}

And to use it in a input would be like this for example:

<input id="math"  type="text"  onkeypress="return isNumberKey(event);" />

Try it: How much is 20+10?

Allow only letters:
(also space, del, enter)

function isAlphaKey(evt){
	var charCode = (evt.which) ? evt.which : event.keyCode;
	 if ((charCode==231 || charCode==199) || (charCode==241 || charCode==209) ||(charCode==8 || charCode==32) || ( (charCode >= 65 && charCode <= 90) || (charCode >= 97 && charCode <= 122) ) ) {
	 	return true;
	 }
	 else {
		 return false;
	 }
}

And to use it in a input would be like this for example:

<input id="name" type="text"  onkeypress="return isAlphaKey(event);"  />

Try it: Your name:

I know should be easier, but just wait a bit for HTML 5 that is going to make our life better. For sure ;)

Post it Board – HTML Template

post it board template HTML

Demo | Download | For Open Classifieds

Since I’m not a web designer, make this templete it’s been a bit difficult for me.

Why I did it then? easy, I want to learn just a bit of CSS, in order of been able to make my own changes also I had an Idea for a template for Open Classifieds but since no one would help me I’ve decided to do it myself.

I will not normally release this short of things.

With Open Classifieds 1.6, that is coming really soon, I hope I will have this template ready by then ;) In the meantime please try 1.6 RC 2.

Browser support for IE 6 is dead

I hate IE6 as many of you do. Long a go I’ve decided that my scripts are not going to be tested in ie6 anymore.

Few webpages they are not longer supporting ie6 and are recommending to change it, to use other browser. But now the giant the “Big Boss” Google is doing one step further to say bye to IE6.

They sent me this email yesterday that I absolutely aprove!
Continue reading ‘Browser support for IE 6 is dead’ »

Input select generated from query – PHP

Just a handy function that I use a lot.

With this function you can generate an input select from a given query.

Parameters:
1- Query to be displayed as a select, the query needs to returns at least 2 values, 1st one for the option value, and the 2nd one for the display value.
2-Input Select name, thisw woud be the name that your select will have in the form.
3-Which option it’s selected from the list. I non is set the first one it’s selected.

function sqlOption($sql,$name,$option){//generates a select tag with the values specified on the sql, 2nd parameter name for the combo, , 3rd value selected if there's
	global $ocdb;
	$result =$ocdb->query($sql);//1 value needs to be the ID, second the Name, if there's more doens't work
	$sqloption= "<select name='".$name."' id='".$name."'>
				<option value='0'>Home</option>";
	while ($row=mysql_fetch_assoc($result))
	{
		$first=mysql_field_name($result, 0);
		$second=mysql_field_name($result, 1);
 
			if ($option==$row[$first]) { $sel="selected=selected";}
			$sqloption=$sqloption .  "<option ".$sel." value='".$row[$first]."'>" .$row[$second]. "</option>";
			$sel="";
	}
		$sqloption=$sqloption . "</select>";
		echo $sqloption;
}

Same function but that can group:
Continue reading ‘Input select generated from query – PHP’ »

Follow me