1stwebdesigner

Posted by | Posted on 17:26

1stwebdesigner


The Ultimate Roundup of Blog Design Tutorials

Posted: 13 Oct 2010 02:00 PM PDT

Creativity has no end to it and especially designing has seen and is seeing a continuous growth in its field. To be creative we need to be updated with the latest updations, and WordPress the most popular blogging platform has seen a rapid development in a quick span of time. Mastering this can become quite a tedious and time consuming process in this case keeping the growing developments in mind.Designing may be quite fun to work with but learning those procedures and technical aspects may give you a tough time. Even the finest details are to be learn and mastered which is not an easy task with developments happening every minute. Tutorials help you in this case where all the help about any task is given in quite an illustrative manner as under the guidance of an expert.

So we present you with some of the tutorials which make make this tedious process easy for you to learn and master in wordpress blog designs.

1.Grunge webdesign

2.Chocolate-pro-wordpress

3.Clean grunge

4.Design grunge

5.Building custom wordpress theme

6.Build wordpress themes

7.Create a wordpress theme from scratch

8.Dark wordpress theme

9.Designing for wordpress

10.Design reviver premium theme

11.Elegant wordpress theme

12.Greenpress

13.Magic night themed webdesign

14.Myblues wordpress

15.Nature inspired painted background

16.Sleek textured Layout

17.Ultimate grunge design

18.Video Blog Web Page

19.Watercolored design

20.Web Layouts

21.Winter wordpress theme

22.wordpress theme

23.Wordpress theme webdesign

24.Old paper layout

25.Photography portfolio

26.Tutzor web 20 style design

27.Vibrant modern blog design in photoshop

28.Black design

29.Unique grunge design

30.Platinum web design

31.Sound system studio weblayout

32.Professional magazine web layout

33.Design agency layout

34.Website design studio

35.Make a green sleek web layout

Awesome Tips and Tricks for PHP Beginners

Posted: 13 Oct 2010 03:00 AM PDT

Ok, so now you have “learned” …. wait should that be a single quote …. PHP and you are ready to really be able to start using it for something more than you can do with HTML. I will get into the use of single quotes vs double quotes, short tags, inline if statements, a few other little tips and tricks.

Single Quotes vs Double Quotes

You may ore may not have even thought about this up to this point in your PHP use but it is kind of a big deal. Using the right or wrong quotes can not only cause errors that might be hard to find but there can be a slight performance boost and can make your code much easier to read.

 <?php      echo 'hello world'; ?> 
 <?php      echo "hello world"; ?> 

These will produce the exact same end result but do you know which one is technically better? The single quote. The single quote just puts exactly what is inside of it without processing while the double quote actually evaluates and processes. Let me explain with an example.

 <?php        $example = 'hello world';        echo '$example'; // outcome will be $example        echo "$example"; // outcome will be hello world ?> 

As you can see here the double quotes take the time to process what is inside so technically there will be a little more overhead. Obviously on a small scale this means nothing but if you have a loop that iterates 1000 times you might start to see the benefits of single quotes in a performance sense.

Now if you are trying to put a variable in a sentence you can do this:

 <?php  	$example = 'hello world';  	echo 'This is my '.$example.' for PHP';  // outcome This is my hello world for PHP 	echo "This is my $example for PHP";  // outcome This is my hello world for PHP ?> 

Either of these will work just the same in getting the output that you want but the single quote will be slightly faster because while both have to process the variable the double quote is also scanning the rest of the sentence in search for anything that it has to process. Yes it is more typing but I personally find the first one much more readable because you can much more clearly see that you are outputing a variable. If this was randomly in a 500 line PHP file the single quote method would be easier to spot.

PHP Short Tags

You know when you just want to prepopulate a form or add one PHP variable into the middle of a an HTML block. Well having to write an open PHP tag and then a close PHP with all of the line breaks and indentions to make it readable is such a pain. So what is the solution? PHP short tags like this.

 <?php 	$example = 'This is some text that I want in my paragraph.'; ?> <html> 	<head> 	</head> 	<body> 		<h1>I love short tags</h1> 		<p> 		< ?php 			echo $example; 		?> 		</p> 	</body> </html> </pre> Personally I like to get things done with as little typing and code as possible, so I am not a fan of this.  I love my short tags. <pre> <?php 	$example = 'This is some text that I want in my paragraph.'; ?> <html> 	<head> 	</head> 	<body> 		<h1>I love short tags</h1> 		<p> 		< ?=$example?> 		</p> 	</body> </html> 

That will produce the exact same output as the first but much neater and with a little less code.
NOTE: Short tags is something that can be disabled in the php.ini so it is not guaranteed to work but industry standard has short tags enabled.

Short Tags With Inline IF Statement

Short tags are also great when used with inline if statements. Having if statements in an area of the code with a lot of HTML can make it harder to read but using inline if with short tags can make it much neater.

 <?php 	$minimum_age = 21; 	$customer = 19; ?> 	<p>You are 	<?php 		if($customer<$minimum_age) 		{ 			echo 'NOT'; 		} 		else 		{ 			echo ''; 		} 	?> 	old enough to buy alcohol here.</p> 

Obviously we do not need the else in this case because it doesn’t do anything. I just have it in there to help understand inline IF statements. Also since there is only one output line we dont need the curly braces.

 <?php 	$minimum_age = 21; 	$customer = 19; ?> 	<p>You are < ?=($customer<$minimum_age?'NOT':'')?> old enough to buy alcohol here.</p> 

You see the inline IF is shorter but might be confusing at first so I will break it down.

 <ul> 	<li>First "$customer< $minimum_age" is exactly the same as "if($customer<$minimum_age)"</li> 	</li><li>Next "?'NOT':" is the same as "{ echo 'NOT'; }" (anthing after the question mark and before the colon is executed if the statement is true.</li> 	<li>The last piece is the "else" ":''" is the same as "else{ echo ''; }" (anything after the colon is what is executed for the else)</li> </ul> 

And lastly for this post I just want to show a little way to dynamically create variables that can make things a little bit quicker for you. One of the best uses for it is when you are making a database call. Here is a traditional example.

 <?php      $id = '1';      $query = mysql_query("SELECT name,title,content FROM blog_post WHERE id='$id' LIMIT 1");      $data = mysql_fetch_assoc($query); ?>      <div id="blog_wrapper">           <h2>< ?=stripslashes($data['title'])?></h2>           <span id="blog_author">< ?=stripslashes($data['name'])?></span>           <p>< ?=stripslashes($data['content'])?></p>      </div> 

Here we run a query and are outputting the data in HTML format. We do stripslashes() on all of the items because when you insert things into the database it will ad slashes to escape special characters. Instead of having to individually do the stripslashes on everything we can do $$key = stripslashes() like this:

 <?php      $id = '1';      $query = mysql_query("SELECT name,title,content FROM blog_post WHERE id='$id' LIMIT 1");      $data = mysql_fetch_assoc($query); 	 if(is_array($data)) 	 { 		foreach($data as $key => $value) 			$$key = stripslashes($value); 	 }      <div id="blog_wrapper">           <h2>< ?=$title?></h2>           <span id="blog_author">< ?=$name)?></span>           <p>< ?=$content)?></p>      </div> 

Now you can see that we can access all of our items from the database like $name,$title,$content. We can do this because the $ in front of $key sets it as a variable with a value of stripslashes($value). Here we are taking the $data array from the query and looping through it. In the foreach($data as $key => $value), $key is the key for that element in the array (which is the reference like $data['name']).

Comments (0)

Post a Comment