tutorial101 is the one place for high quality web development, Web Design and software development tutorials and Resources programming. Learn cutting edge techniques in web development, design and software development, download source components and participate in the community.
php how to get tomorow date Use the mktime function to create a timestamp for tomorrow. To go one day in the future we simply add one to the day mktime(hour, minute, second, month, day, year, daylight savings time)
<? $tomorrow = mktime(0, 0, 0, date("m"), date("d")+1, date("y")); echo "Tomorrow is ".date("m/d/y", $tomorrow); //out now date 03/03/11 tomorow is 03/04/11 ?>
<div id="div1"> <?php //insert new post // Create post object $my_post = array(); $my_post['post_title'] = 'Hello world'; $my_post['post_content'] = 'This is a sample post'; $my_post['post_status'] = 'published'; $my_post['post_author'] = 7; //the id of the author $my_post['post_category'] = array(10,12); //the id's of the categories
// Insert the post into the database $post_id = wp_insert_post( $my_post ); //store new post id into $post_id
//now add tags to new post $tags = array('html', 'css', 'javascript'); wp_set_object_terms( $post_id, $tags, 'post_tag', true );
1. Single-line vs. Multi-line multiple lines, like this: .title { font-size:14px; line-height:20px; color:blue; } Or on one or single line, like this: .title {font-size:14px;line-height:20px;color:blue;}
2. Section Your File comment above each section is all you need: /*** Header ***/
3. Start With a Reset * {margin:0;padding:0;}
4. Use Shorthand CSS Shorthand CSS is combining a few related rules into one. Example .example { background-color: blue; background-image: url(images/blue-bg.jpg); background-position: 100% 0; background-repeat: no-repeat; } Shorthand .example {background: blue url(images/blue-bg.jpg) 100% 0 no-repeat;}
5. Multiple Classes on One Element The reason to do this is that you can define generic CSS styles that can be applied to a number of elements. <p class="info left">Some example text in your info paragraph.</p>
6. Positioning Header Elements #header {position:relative;width:960px;height:120px;}
<script type="text/javascript"> function register(){ //when the button is pressed, this function will be executed. $.ajax({ type: "POST", // AJAX function url: "submit_data.php", //Method data: "username=" + document.getElementById("username").value + "&email=" + document.getElementById("email").value, // executed when the button is pressed. success: function(html){ $("#response").html(html); //response html output echo } });
Generate RSS Feed with PHP <?php include('db.php'); $sql = "SELECT * FROM site_data ORDER BY id DESC LIMIT 20"; $query = mysql_query($sql) or die(mysql_error());
header("Content-type: text/xml");
echo "<?xml version='1.0' encoding='UTF-8'?> <rss version='2.0'> <channel> <title>r-ednalan.blogspot.com | Programming Blog </title> <link>http://r-ednalan.blogspot.com</link> <description>Programming Blog </description> <language>en-us</language>";
javascript Accept terms before submitting the form you must accept term and condition <script> var checkobj function agreesubmit(el){ checkobj=el if (document.all||document.getElementById){ for (i=0;i<checkobj.form.length;i++){ var tempobj=checkobj.form.elements[i] if(tempobj.type.toLowerCase()=="submit") tempobj.disabled=!checkobj.checked } } }
function defaultagree(el){ if (!document.all&&!document.getElementById){ if (window.checkobj&&checkobj.checked) return true else{ alert("Please read/accept terms to submit form") return false } } } document.forms.agreeform.agreecheck.checked=false </script> <form name="agreeform" onSubmit="return defaultagree(this)"> <input name="agreecheck" type="checkbox" onClick="agreesubmit(this)"><b>I agree to the above terms</b><br> <input type="Submit" value="Submit!" disabled> </form>
<script type="text/javascript"> var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i function checkmail(e){ var returnval=emailfilter.test(e.value) if (returnval==false){ alert("Please enter a valid email address.") e.select() } return returnval } </script>
1. Prevent Firefox Scrollbar Jump
Firefox usually hides the vertical scrollbar if size of the content is less than the visible window but you can fix that using this simple CSS trick. html{ overflow-y:scroll; }
2. Cross Browser Minimum Height
Internet Explorer does not understand the min-height property but here’s the CSS trick to accomplish that in IE. #container{ height:auto !important;/*all browsers except ie6 will respect the !important flag*/ min-height:500px; height:500px;/*Should have the same value as the min height above*/ }
3. Highlight links that open in a new window
a[target="_blank"]:before,
a[target="new"]:before {
margin:0 5px 0 0;
padding:1px;
outline:1px solid #333;
color:#333;
background:#ff9;
font:12px "Zapf Dingbats";
content: "\279C";
}
4. Drop Caps Using CSS
p:first-letter{
display:block;
margin:5px 0 0 5px;
float:left;
color:#FF3366;
font-size:3.0em;
font-family:Georgia;
}
5. Cross Browser Opacity
CSS3 standard includes the opacity property, but not every browser supports it, here’s the CSS trick for cross browser transparency. .transparent_class {
filter:alpha(opacity=50);
-moz-opacity:0.5;
-khtml-opacity: 0.5;
opacity: 0.5;
}
6. Vertical centering with line-height
If you are using fixed height container and need to vertically center the text, use the line-height property to do that perfectly. line-height:30px;
4. Remove vertical textarea scrollbar in IE
IE adds a vertical scrollbar to textarea input fields regardless of the height of content in it. You can fix that with this simple CSS trick. textarea{
overflow:auto;
}
8. Highlight Text Input Fields
highlight the input field currently in focus. This trick does not work in IE though. input[type=text]:focus, input[type=password]:focus{
border:2px solid #000;
}
10. Text Shadow Property in CSS3
The text-shadow property looks cool, but it is currently not supported by major browsers including Firefox 3.0, but will be supported in Firefox 3.1 beta. Browsers that support this CSS3 property are Safari 3+, Konquerer, Opera9.5+ and iCab. text-shadow: 3px 3px 4px #999; text-shadow: 0 1px 0 #FFFFFF;
11. z-index - content slider block cover over the drop-down menu Adding z-index: 0; in the contentslider.css fixes it
#slider { z-index: 0; }