-
Webite for ebook
Wednesday, 26 December 2012
http://www.wowebook.bePosted by Unknown at 22:05 | Labels: websites | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
SMTP configuration in Xampp server to send email in php
Friday, 21 December 2012
Only have to modify 2 ini files: php.ini and sendmail.ini
1)look for mail function in php.ini(c:/xampp/php/php.ini)>>[mail function]
change the following::
SMTP=smtp.gmail.com
smtp_port=587
sendmail_from = [your_gmail_username]@gmail.com
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
NOTE: remove ; if it present before above lines.
2) next modify sendmail.ini(c:/xampp/sendmail/sendmail.ini)
comment the mercury as shown below
# Mercury
#account Mercury
#host localhost
#from postmaster@localhost
#auth off
# A freemail service example
#account Hotmail
#tls on
#tls_certcheck off
#host smtp.live.com
#from [exampleuser]@hotmail.com
#auth on
#user [exampleuser]@hotmail.com
#password [examplepassword]
then paste the following lines:
account Gmail
tls on
tls_certcheck off
host smtp.gmail.com
from [your_gmail_username]@gmail.com
auth on
user[your_gmail_username]@gmail.com
password x
port 587
# Set a default account
account default : Gmail
Again SAVE your changes.
Use the code below to test if it's working!
<?php
$subject="Test mail";
$to="someone@whatever.com";
$body="This is a test mail";
if (mail($to,$subject,$body))
echo "Mail sent successfully!";
else
echo"Mail not sent!";
?>
Refer:
http://www.daniweb.com/web-development/php/threads/347696/sending-email-from-localhost-in-xampp-windows
http://expertester.wordpress.com/2010/07/07/how-to-send-email-from-xampp-php/
Posted by Unknown at 04:35 | Labels: php | 4 comments | Email This BlogThis! Share to X Share to Facebook |
-
Jquery Prompt box
Thursday, 20 December 2012
Jquery Prompt box
http://trentrichardson.com/Impromptu/Posted by Unknown at 05:09 | Labels: jquery, Js, websites | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
Cakephp onclick() event for link
<?php echo $html->link('Buy It',array('controller' => 'controllername', 'action' => 'functionname',$param), array('onclick' =>"return getnumber()",'escape' => false)); ?>Posted by Unknown at 05:06 | Labels: cakephp | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
Websites to know phpframeworks!!
Wednesday, 19 December 2012
To know details about phpframeworks
http://www.phpframeworks.com/
To get meny details about php
http://www.hotscripts.com
Plugin for cakephp with all features used in DBuy
croogo.org
Shopping cart plugin for cakephp
Vamcart
http://vamcart.comPosted by Unknown at 04:01 | Labels: cakephp, php, websites | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
Websites to know
Monday, 17 December 2012
http://www.oneindia.in/
http://www.network18online.com
Posted by Unknown at 21:38 | Labels: websites | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
http://www.wordhippo.com/
http://en.bab.la/dictionary/Posted by Unknown at 03:25 | Labels: vocabulary | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
http://www.alexa.com/
Posted by Unknown at 03:24 | Labels: websites | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
Html to Wordpress theme conversion links!!
Friday, 14 December 2012
Refer:
http://thethemefoundry.com/blog/html-wordpress/
http://www.wphub.com/tutorials/convert-a-html-template-into-a-wordpress-theme/Posted by Unknown at 05:22 | Labels: wordpress | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
Step1: Split the html index file into three parts(this three files are most essential to make a wp template )
header.php (contains header of the template)
index.php (contains main content of the template)
footer.php (contains footer part of the template).
Step2: index.php loads first so In index.php at start of the code add <?php get_header; ?> to call header part and at the end of the code add <?php get_footer(); ?> to call footer part.
Step3: Then create style.css file and copy all html css to this file and also add a template information at the top.
This is the template description to be added in style.css, without this we cannot install theme.
/* Theme Name: Replace with your Theme's name. Theme URI: Your Theme's URI Description: A brief description. Version: 1.0 Author: You Author URI: Your website address. */
Step4:To call external css use
<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
Step5:To call image in wordpress file
<img src="<?php bloginfo('template_directory'); ?>/images/image-name.jpg" width="631" height="307" alt="">
To call image in css
background:url('images/image-name.jpg');
Step6:To display post in home page add code in index.php as mentioned below in main content area
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="post-header">
<div class="date"><?php the_time( 'M j y' ); ?></div>
<h2><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<div class="author"><?php the_author(); ?></div>
</div><!--end post header-->
<div class="entry clear">
<?php if ( function_exists( 'add_theme_support' ) ) the_post_thumbnail(); ?>
<?php the_content(); ?>
<?php edit_post_link(); ?>
<?php wp_link_pages(); ?>
</div><!--end entry-->
<div class="post-footer">
<div class="comments"><?php comments_popup_link( 'Leave a Comment', '1 Comment', '% Comments' ); ?></div>
</div><!--end post footer--
</div><!--end post-->
<?php endwhile; /* rewind or continue if all posts have been fetched */ ?>
<div class="navigation index">
<div class="alignleft"><?php next_posts_link( 'Older Entries' ); ?></div>
<div class="alignright"><?php previous_posts_link( 'Newer Entries' ); ?></div>
</div><!--end navigation-->
<?php else : ?>
<?php endif; ?>
Step7: To make pages as menu add this code in header.php
<?php wp_page_menu('show_home=1&sort_column=menu_order'); ?>
Step8:To make separate layout for all other pages except home page include page.php(create as such as like index.php only html layout should change). It will function like index.php for all other pages so layout will get change.Another method, to add separate layout for home page is include home.php(create as such as like index.php only html layout should change) so that for home alone home.php will be used for all other pages index.php will be used.
Step9:To make a separate layout for post add post.php.
Step10:To make redirection when clicking on logo to go home page add <?php echo $home_url(); ?>
Step11:To add sidebar follow steps
1.To add sidebar first want to register sidebar in function.php. Create function.php file and add the below code into it
<?php
function my_register_sidebars() { /* Register the sidebar. */ register_sidebar( array( 'id' => 'sidebar', 'name' => __( 'Sidebar' ), 'description' => __( 'A short description of the sidebar.' ), 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>' ) ); /* Repeat register_sidebar() code for additional sidebars. */ } add_action( 'widgets_init', 'my_register_sidebars' ); ?> </php>
To register another sidebar use below code
<?php
function my_register_sidebars() {
/* Register the sidebar. */
/*This is the first sidebar */
register_sidebar(
array(
'id' => 'sidebar',
'name' => __( 'Sidebar' ),
'description' => __( 'A short description of the sidebar.' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widget-title" style = "padding:0px 0 0 20px ;">',
'after_title' => '</h3>'
)
);
/*This is the second sidebar */
register_sidebar(
array(
'id' => 'footer-sidebar',
'name' => __( 'Sidebar1' ),
'description' => __( 'A short description of the sidebar1.' ),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>'
)
);
/* Repeat register_sidebar() code for additional sidebars. */
}
add_action( 'widgets_init', 'my_register_sidebars' );
?>
2. WordPress themes use a default file called sidebar.php to display sidebars on pages and posts.Call the registerd sidebar in sidebar.php to use it.This is to create first sidebar.
<?php
if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('sidebar') ) :
endif;
// !dynamic_sidebar('sidebar') ) : here sidebar is the registered sidebar id called here
?>
To add another sidebar for example to diaplay sidebar in footer create sidebar-footer.php file and add code
<?php
if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('footer-sidebar') ) :
endif;
?>
//!dynamic_sidebar('footer-sidebar') ) : here sidebar is the registered sidebar id called here
3.To diaplay sidebar in view call sidebar like <?php get_sidebar(); ?> in HTML file .This will call the first sidebar.
To display another registred sidebar call like <?php get_sidebar('footer'); ?> because our file name must follow this construct: sidebar-_______.php. In our example sidebar-footer.php is called as <?php get_sidebar('footer'); ?> .
Refer:
http://www.tastyplacement.com/add-sidebar-wordpress
http://www.wphub.com/tutorials/convert-a-html-template-into-a-wordpress-theme/Posted by Unknown at 04:10 | Labels: wordpress | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
Awesome templates
http://www.freewebsitetemplates.comPosted by Unknown at 04:00 | Labels: html | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
A GMap Example - Place Marker with info Window
Wednesday, 12 December 2012
Main HTML Page
<script type="text/javascript">
var infowindow = null;
var lat, lng;
var map;
var directionDisplay;
var directionsService = new google.maps.DirectionsService();
$(document).ready(function () { initialize('1'); }); // on doc ready call initialize
function initialize(id) {
//alert(id);
directionsDisplay = new google.maps.DirectionsRenderer(); // create direction render object
<?php $city_name = Configure::read('pre_city_select'); ?> // select city name to create canvas
<?php //$city_name = '2/3A 2nd Floor, Medavakkam, Chennai'; ?>
geocoder = new google.maps.Geocoder(); // create new geocoder object to find lat lang
/* find lat and lng for city name */
geocoder.geocode({ 'address': '<?php echo $city_name; ?>' }, function(results, status) {
//var myLatLng = results[0].geometry.location;
var myLatLng = new String(results[0].geometry.location);
var removebrace = myLatLng.replace(/\(/g,"");
var str = removebrace.replace(/\)/g, '');
var latlng1 = str.split(',');
lat = parseFloat(latlng1[0]);
lng = parseFloat(latlng1[1]);
//alert(lat);
//alert(lng);
var centerMap = new google.maps.LatLng(lat, lng);
/* Setting options for new map */
var myOptions = {
zoom: 11,
center: centerMap,
scrollwheel: false,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
/* Drawing map in the page */
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
directionsDisplay.setMap(map);
//setMarkers(map, sites);
/* Create new global info window */
infowindow = new google.maps.InfoWindow({
content: "loading..."
});
var bikeLayer = new google.maps.BicyclingLayer();
bikeLayer.setMap(map);
if(id == 'SearchMap') {
var loc = document.getElementById('LocationmasterName').value;
var cat = document.getElementById('SubcatName').value;
var QueryString = loc + '&subcatname=' + cat;
/* get input for placing markers */
/* Note - dataType should be specified as json in ajax call, so that it can interpret */
$.ajax({
type : "POST",
//data : $('#UserAjaxloginForm').serialize(),
url : myBaseUrl+('/deals/search_map?locationname=')+QueryString,
dataType: 'json',
//url : "/dealzbuyp4sep15/index.php/users/ajaxlogin?un="+(($('#UserUsername').val())),
success : function(opt){
alert(opt);
setMarkers(map, opt);
}
});
}
else {
$.ajax({
type : "POST",
//data : $('#UserAjaxloginForm').serialize(),
url : myBaseUrl+('/deals/maplatlng?id=')+id,
dataType: 'json',
//url : "/dealzbuyp4sep15/index.php/users/ajaxlogin?un="+(($('#UserUsername').val())),
success : function(opt){
//alert(id);
setMarkers(map, opt);
}
});
}
});
}
/* Actual Input for marker should be like this */
/* var sites = [
['Mount Evans', 39.58108, -105.63535, 4, 'This is Mount Evans.'],
['Irving Homestead', 40.315939, -105.440630, 2, 'This is the Irving Homestead.'],
['Badlands National Park', 43.785890, -101.90175, 1, 'This is Badlands National Park'],
['Flatirons in the Spring', 39.99948, -105.28370, 3, 'These are the Flatirons in the spring.']
]; */
/* Function to place markers in the map drawn */
function setMarkers(map, markers) {
/* Setting up image for marker. If not set, default from google will be used. */
markerimage = myBaseUrl+'/theme/dealzbuy/img/z1.png'
for (var i = 0; i < markers.length; i++) {
var siteLatLng = new google.maps.LatLng(markers[i][1], markers[i][2]);
var title = markers[i][0];
//var zIndex = markers[i][2];
var html = markers[i][3];
var marker = new google.maps.Marker({
position: siteLatLng,
animation: google.maps.Animation.DROP,
icon: markerimage,
map: map,
title: title,
//zIndex: zIndex,
html: html
});
var contentString = "Some content";
/* On click of marker open info window */
google.maps.event.addListener(marker, "click", function () {
//alert(this.html);
infowindow.setContent(this.html);
infowindow.open(map, this);
});
$('#container').slideUp(2000);
// $('#container2').show();
}
}
/* Function to find direction from start to destination */
function calcRoute(a,b) {
//var stlat = google.loader.ClientLocation.latitude;
//var stlng = google.loader.ClientLocation.langitude;
//var start = new google.maps.LatLng(stlat, stlng);
/* Get start place from user */
var startplace = prompt("Please type your origin point");
var start = startplace;
var end = new google.maps.LatLng(a, b);
var request = {
origin:start,
destination:end,
travelMode: google.maps.DirectionsTravelMode.DRIVING
};
directionsService.route(request, function(response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
}
});
}
</script>
Finding Lat Lng for place in a php page
/* Set up an google URL to get details */
/* Note -
Address should be specified in the same format as shown below. There should not be any spaces or new line characters. Better is to replace them with a plus symbol.
Sensor=false is mandatory.
*/
$url = 'http://maps.googleapis.com/maps/api/geocode/json?address=123,+100feet+road,+Velachery,+Chennai+600042&sensor=false';
$google_response = json_decode(file_get_contents($url));
$lat = $google_response->results[0]->geometry->location->lat;
$lng = $google_response->results[0]->geometry->location->lng;
PHP Page to provide dynamic input on ajax call
<?php
$input = array(
array("Bondi Beach", "-33.890542", "151.274856", "4", "This is Bondi Beach."),
array("Coogee Beach", "-34.028249", "151.157507", "3", "This is Coogee Beach.")
);
echo json_encode($input);
?>
Posted by Unknown at 21:35 | Labels: ajax, cakephp, gmap | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
Online photoshop
http://pixlr.comPosted by Unknown at 01:05 | Labels: Online works in website | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
Links to get multiple file uplaod
http://www.fyneworks.com/jquery/multiple-file-upload/#tab-Examples
http://www.cult-f.net/multiple-file-uploaders/Posted by Unknown at 01:01 | Labels: jquery, php | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
Encoding Paremeters!!
Tuesday, 11 December 2012
base64_encode() and base64_decode() is used to encode the string that can be used in link parameter also.Posted by Unknown at 00:56 | Labels: cakephp, php | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
It works in .htaccess
My work Did in websiteRewriteEngine On RewriteCond %{HTTP_HOST} ^domain\.com$ [NC] RewriteRule ^.*$ http://www.domain.com%{REQUEST_URI} [R=301,L] # <-- Mind the 'L'! RewriteRule ^$ webroot/ [L] RewriteRule (.*) webroot/$1 [L]
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^dbuy\.com$ [NC]
RewriteRule ^.*$ http://www.dbuy.com%{REQUEST_URI} [R=301,L] #
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>Posted by Unknown at 00:47 | Labels: cakephp | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
To get client place using reverse geocoding and ClientLocation Finder!!
Thursday, 6 December 2012
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Google Maps JavaScript API v3 Example: Reverse Geocoding</title>
<link href="https://google-developers.appspot.com/maps/documentation/javascript/examples/default.css" rel="stylesheet">
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script src="http://www.google.com/jsapi"></script>
<script>
var geocoder;
var map;
var infowindow = new google.maps.InfoWindow();
var marker;
geocoder = new google.maps.Geocoder();
function initialize() {
var latlng = new google.maps.LatLng(40.730885,-73.997383);
var mapOptions = {
zoom: 8,
center: latlng,
mapTypeId: 'roadmap'
}
// alert(mapOptions);
map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
}
function codeLatLng() {
// var input = document.getElementById('latlng').value;
if(google.loader.ClientLocation)
{
latitude = google.loader.ClientLocation.latitude;
longitude = google.loader.ClientLocation.longitude;
}
// var input = '13.083,80.3';
var input = latitude + ',' + longitude;
alert(input);
var latlngStr = input.split(',', 2);
var lat = parseFloat(latlngStr[0]);
var lng = parseFloat(latlngStr[1]);
var latlng = new google.maps.LatLng(lat, lng);
geocoder.geocode({'latLng': latlng}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
if (results[1]) {
/* map.setZoom(11);
marker = new google.maps.Marker({
position: latlng,
map: map
}); */
//infowindow.setContent(results[1].formatted_address);
alert(results[1].formatted_address);
//infowindow.open(map, marker);
} else {
alert('No results found');
}
} else {
alert('Geocoder failed due to: ' + status);
}
});
}
</script>
</head>
<body onload="codeLatLng()">
<div>
<input id="latlng" type="textbox" value="40.714224,-73.961452">
</div>
<div>
<input type="button" value="Reverse Geocode" onclick="codeLatLng()">
</div>
<div id="map_canvas" style="height: 90%; top:60px; border: 1px solid black;"></div>
</body>
</html>
Posted by Unknown at 00:24 | Labels: gmap | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
Reverse Geocoding to get address using latitude and longitude!!
Wednesday, 5 December 2012
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Google Maps JavaScript API v3 Example: Reverse Geocoding</title>
<link href="https://google-developers.appspot.com/maps/documentation/javascript/examples/default.css" rel="stylesheet">
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script>
var geocoder;
var map;
var infowindow = new google.maps.InfoWindow();
var marker;
function initialize() {
geocoder = new google.maps.Geocoder();
var latlng = new google.maps.LatLng(40.730885,-73.997383);
var mapOptions = {
zoom: 8,
center: latlng,
mapTypeId: 'roadmap'
}
// alert(mapOptions);
map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
}
function codeLatLng() {
var input = document.getElementById('latlng').value;
var latlngStr = input.split(',', 2);
var lat = parseFloat(latlngStr[0]);
var lng = parseFloat(latlngStr[1]);
var latlng = new google.maps.LatLng(lat, lng);
geocoder.geocode({'latLng': latlng}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
if (results[1]) {
map.setZoom(11);
marker = new google.maps.Marker({
position: latlng,
map: map
});
infowindow.setContent(results[1].formatted_address);
alert(results[1].formatted_address);
infowindow.open(map, marker);
} else {
alert('No results found');
}
} else {
alert('Geocoder failed due to: ' + status);
}
});
}
</script>
</head>
<body onload="initialize()">
<div>
<input id="latlng" type="textbox" value="40.714224,-73.961452">
</div>
<div>
<input type="button" value="Reverse Geocode" onclick="codeLatLng()">
</div>
<div id="map_canvas" style="height: 90%; top:60px; border: 1px solid black;"></div>
</body>
</html>
Refer:
https://developers.google.com/maps/documentation/javascript/geocoding#ReverseGeocoding
Posted by Unknown at 23:44 | Labels: gmap | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
<html>
<head>
<title>google location test</title>
<script src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
var city = latitude = longitude = country = region = "dunno";
if (google.loader.ClientLocation) {
latitude = google.loader.ClientLocation.latitude;
longitude = google.loader.ClientLocation.longitude;
city = google.loader.ClientLocation.address.city;
region = google.loader.ClientLocation.address.region;
country = google.loader.ClientLocation.address.country;
}
</script>
</head>
<body>
<h1>You are in (roughly): <script type="text/javascript">
document.write(city);
</script></h1>
Other parts of the location include:
<script type="text/javascript">
document.write("Latitude: "+latitude+"<br/>");
document.write("Longitude: "+longitude+"<br/>");
document.write("City: "+city+"<br/>");
document.write("Region: "+region+"<br/>");
document.write("Country: "+country+"<br/>");
</script>
</body>
</html>
google location test
Refer: http://csausdev.wordpress.com/2009/10/12/trying-out-google-client-location-service/
In this client city info will not be there so use reverse geocoding to get client city info using latitude and longitude value.
Posted by Unknown at 23:42 | Labels: gmap | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
Jquery redirecting to privious page!!
Monday, 3 December 2012
Jquery redirecting to privious page!!
history.go(-1);Posted by Unknown at 05:26 | Labels: jquery | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
Jquey to execute on page load
$(document).ready(function() { // Handler for .ready() called. });
Jquey to execute after page load
$(function() { // Handler for .ready() called. });
Posted by Unknown at 05:09 | Labels: jquery | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
Jquery function passing parameters!!
Wednesday, 28 November 2012
php echo $row['id']; ?>">Edit User
$('a.edit').click(function () { var id = $(this).data('id'); // do something with the id return false; });
Posted by Unknown at 04:03 | Labels: jquery | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
JQuery website for ajax content, pagination, email check, and more....
Tuesday, 27 November 2012
JQuery website for ajax content, pagination, email check, and more....
http://www.mix26.com/Posted by Unknown at 23:19 | Labels: ajax, jquery | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
JQuery Auto complete plugin
http://jqueryui.com/autocomplete/Html->script('jquery-ui'); ?>Html->css('jquery-ui'); ?>//$('#tags').keypress(function(){ // when clicked sign in button ajax call performsvar availableTags1;$(function() {$.ajax({type : "POST",//data : $('#UserAjaxloginForm').serialize(),//url : 'http://localhost/autosuggest/autosuggest1.php',url : myBaseUrl+('/home/autoComplete'),//url : "/dealzbuyp4sep15/index.php/users/ajaxlogin?un="+(($('#UserUsername').val())),success : function(opt){av = new String(opt)availableTags1 = av.split(',');//alert(availableTags1);$( "#LocationmasterName" ).autocomplete({source: availableTags1});}});});function searchValidate(){$('#LocationmasterName').html('');$('#SubcatName').html('');if(($('#LocationmasterName').val() == '' || $('#LocationmasterName').val() == 'Local search...' || $('#LocationmasterName').val() == 'No results found' ) && ($('#SubcatName').val() == '' || $('#SubcatName').val() == 'I am Looking For...' || $('#SubcatName').val() == 'No results found' ) ){$('#LocationmasterNameMsg').attr('value', 'No results found');$('#SubcatName').attr('value', 'No results found');return false;}else{return true;}}$(document).ready(function(){$("#SubcatName").focusout(function() {var searchword = $( "#SubcatName" ).val();if((jQuery.inArray(searchword, availableTags2) < 0) && $( "#SubcatName" ).val() != ''){$('#SubcatName').attr('value', 'No results found');}});});$(document).ready(function(){$("#LocationmasterName").focusout(function() {var locationsearchword = $( "#LocationmasterName" ).val();if((jQuery.inArray(locationsearchword , availableTags1) < 0) && $( "#LocationmasterName" ).val() != ''){$('#LocationmasterName').attr('value', 'No results found');}});});
Html formForm->input('place',array('label' => '','id' => 'LocationmasterName', 'title' => 'Local search...')); ?>Posted by Unknown at 01:09 | Labels: ajax, jquery | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
Populate Dropdown on select of another - cakephp
Monday, 26 November 2012
Note: Ignore all comments
SCRIPT
<script type="text/javascript">var myBaseUrl = '<?php echo $this->base; ?>';</script> // finds the base URL
<script type="text/javascript">
$(document).ready(function(){
$('#DealTypemasterId').change(function(){ // when dropdown value gets changed function executes
$.ajax({
type : "POST",
url : myBaseUrl + ('/deals/populateSubcat') + '?q=' + $("#DealTypemasterId option:selected").val(), //pass query string to server
success : function(opt){
document.getElementById('DealSubcatId').innerHTML = opt; // assign the output to another dropdown
}
})
});
});
</script>
HTML
<?php echo $this->Form->create('Deal');?>
<?php echo $this->Form->input('typemaster_id', $typemasters);?>
<?php echo $this->Form->input('subcat_id', $subcats);?>
<?php echo $this->Form->input('merchantmaster_id', $merchantmasters);?><br />
<?php echo $this->Form->end(__('Submit', true));?>
PHP
Controller:
//fetch all data from database
function populateSubcat()
{
$location = $this->Subcat->find('list', array('fields' => array('name')));
$this->set('locations', $location);
$this->layout = 'ajax';
}
View://print the values set in controller in the format of javascript array, which is needed for autocomplete jquery.<?php$locat = implode(',', $locations);echo $locat;?>
Posted by Unknown at 23:25 | Labels: ajax, cakephp | 1 comments | Email This BlogThis! Share to X Share to Facebook |
-
Jquery functions for event
$(document).ready(function(){$("#yourid").focusout(function() {alert('coding here');});});Posted by Unknown at 23:24 | Labels: jquery | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
$('#yourElementId').attr('title', 'your new title');
var assign = $('#yourElementId').attr('title');
Posted by Unknown at 23:17 | Labels: jquery | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
Cake php!! Passing parameter using form submit.
Friday, 9 November 2012
Paasing parameter and submitting image using form
<?php echo $this->Form->create('Deal', array('url' => array($mid,$mname),'type' => 'file'));?>Posted by Unknown at 01:32 | Labels: cakephp | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
To test like button in website
https://developers.facebook.com/tools/debug
Multiple like button in a page
http://hillarsaare.com/multiple-facebook-like-buttons-on-one-page/
Meta tag for like button
http://blog.smartwebsitetips.com/75/how-to-force-facebook-choose-right-image-for-like-button/Posted by Unknown at 01:18 | Labels: plugin | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
Php date difference!!
Thursday, 8 November 2012
Php date difference between sql date and current date:
<?php $curtime = date("Y-m-d H:i:s"); // Mysql date format
$endtime = $sd['denddate'];
$ts1 = strtotime($curtime);
$ts2 = strtotime($endtime);
$diff = ($ts2 - $ts1)/3600/24;
echo round($diff); ?>Posted by Unknown at 01:51 | Labels: php | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
Php email validation!!
Tuesday, 6 November 2012
<?php
$email_a = 'joe@example.com';
if (filter_var($email_a, FILTER_VALIDATE_EMAIL)) {
echo "This (email_a) email address is considered valid.";
}
?>
Using regular expression
<?php
ereg("^[a-zA-Z0-9_]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$]",
$email);
?>Posted by Unknown at 02:11 | Labels: php | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
Php to generate random numbers!!
Thursday, 1 November 2012
Random string generation
function generateRandomString($length = 10) { // to generate rendom strings
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, strlen($characters) - 1)];
}
return $randomString;
//refer :http://stackoverflow.com/questions/4356289/php-random-string-generator
}
Posted by Unknown at 23:50 | Labels: php | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
Websites to learn!!
Tuesday, 30 October 2012
http://www.javascriptkit.com/
http://ntt.cc/2008/05/10/over-10-useful-javascript-regular-expression-functions-to-improve-your-web-applications-efficiency.html
http://htmldog.com - html
http://freeajaxscripts.net - ajax
Javascript
Coundown timer
http://keith-wood.name/countdown.html
Jquery code
http://jsfiddle.net/tqyj4/4/Posted by Unknown at 07:45 | Labels: ajax, html, Js, websites | 0 comments | Email This BlogThis! Share to X Share to Facebook |
-
Javascript to validate all form fields when onSubmit
function checkrefereremail(){
//var testresults
var nam=document.getElementById('name').value;
var mob=document.getElementById('contactno').value;
var str=document.getElementById('emailid').value;
var anum=/(^\d+$)|(^\d+\.\d+$)/ // integer validation
var flag=1;
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i // email validation
$('#namemsg').html('');$('#mobmsg').html('');$('#emailmsg').html('');$('#captchamsg').html('');
if(nam == '')
{
document.getElementById("namemsg").innerHTML = "Please input a valid name!";
flag++;
}
if (anum.test(mob) == false)
{
document.getElementById("mobmsg").innerHTML = "Please input a valid mobile no!";
flag++;
}
if(filter.test(str) == false){
document.getElementById("emailmsg").innerHTML = "Please input a valid email address!";
flag++;
}else
{
return Captcharesult()
return true;
}
}
</script>
Refer mydala view source:
<script>
function user()
{
var isflag=1;
$('#emailidErr').html('');$('#cpasswordErr').html('');$('#passwordErr').html('');$('#mobilenoErr').html('');$('#dobErr').html('');$('#tcboxErr').html('');$('#captchaErr').html('');
if($('#emailid').val()=='')
{
$('#emailid').addClass("red-border");
$('#emailidErr').html('<p>Please Enter Email Id</p>');
isflag++;
}else{
var emailFilter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i; // Both work same:and are userful /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/
if(!(emailFilter.test($('#emailid').val())))
{
$('#emailid').addClass("red-border");
$('#emailid').val('');
$('#emailidErr').html('<p>Please Enter Valid Email Id</p>');
isflag++;
}
}
if($('#password').val()=='')
{
$('#password').addClass("red-border");
$('#passwordErr').html('<p>Please Enter Password</p>');
isflag++;
}else{
var Password = $('#password').val();
if(Password.length<6)
{
$('#passwordErr').html('<p>Please Enter Six digit in Password</p>');
$('#password').addClass("red-border");
isflag++;
}
if(Password!=$('#cpassword').val())
{
$('#cpassword').addClass("red-border");
$('#cpasswordErr').html('<p>Please Enter Same Password in Confirm Password</p>');
isflag++;
}
}
if($('#mobileno').val()!='' )
{
if(!($('#mobileno').val().match(/^[0-9]+$/)))
{
$('#mobileno').addClass("red-border");
$('#mobilenoErr').html('<p>Please Enter Numeric Value in Mobile Number!</p>');
isflag++;
}
var Mobile=$('#mobileno').val();
if ((Mobile.length<10))
{
$('#mobilenoErr').html('<p>Please Enter Ten digit in Mobile Number!</p>');
$('#mobileno').addClass("red-border");
isflag++;
}
if ((Mobile.length>10))
{
$('#mobilenoErr').html('<p>Please Enter Ten digit in Mobile Number!</p>');
$('#mobileno').addClass("red-border");
isflag++;
}
}
else
{
$('#mobileno').addClass("red-border");
$('#mobilenoErr').html('<p>Please Enter Your Mobile Number</p>');
isflag++;
}
if($('#cityid').val()=='')
{
$('#cityid').addClass("red-border");
$('#cityidErr').html('<p>Please Select City</p>');
isflag++;
}
if($('#date_dd').val()=="" && $('#date_mm').val()=="" && $('#date_yy').val()=="")
{
if($('#date_dd').val()==""){$('#date_dd').addClass("red-border");}
if($('#date_mm').val()==""){$('#date_mm').addClass("red-border");}
if($('#date_yy').val()==""){$('#date_yy').addClass("red-border");}
$('#dobErr').html('<p>Please Select Date of Birth!</p>');
isflag++;
}
if($('#b_pincode').val()!='' )
{
if(!($('#b_pincode').val().match(/^[0-9]+$/)))
{
$('#b_pincode').addClass("red-border");
$('#b_pincodeErr').html('<p>Please Enter Numeric Value in Zip Code!</p>');
isflag++;
}
var zipcode=$('#b_pincode').val();
if ((zipcode.length<6))
{
$('#b_pincodeErr').html('<p>Please Enter six digit in Zip Code!</p>');
$('#b_pincode').addClass("red-border");
isflag++;
}
if ((zipcode.length>6))
{
$('#b_pincodeErr').html('<p>Please Enter six digit in Zip Code!</p>');
$('#b_pincode').addClass("red-border");
isflag++;
}
}
if($('#captcha').val()==''){
$('#captcha').addClass("red-border");
$('#captchaErr').html('<p>Please Enter Verification code</p>');
isflag++;
}
if(document.form_user.tcbox.checked == false)
{
$('#tcbox').addClass("red-border");
$('#tcboxErr').html('<p>Please accept the T&C.</p>');
isflag++;
}
if(isflag > 1){
$('#loginerror').show();
return false;
}
document.getElementById('form_user').submit();
document.form_user.submit();
}
</script>Posted by Unknown at 04:22 | Labels: Js | 0 comments | Email This BlogThis! Share to X Share to Facebook |