Tagged with " show"
Jan 17, 2009 - JavaScript, PHP    5 Comments

JavaScript: Div & Element hide & show cross-browser script solution

Hello Guys,

Today I was working in a project where I had to add element hide and show depending on the condition. For example, if the client wants to contact by phone, the phone DIV element or area appears. If not, the phone DIV element hide quickly. I was writing scripts for this. But to my surprise, I noticed that none of them are cross-browser supporting. When one scripting working in few browsers, the same script is not working in other browsers. So, I struggled to come up with the cross-browser solution and at last, I succeeded. You can use this code in your form whenever you need to show and hide elements dynamically in JavaScript. This script is a kind of Contact Us form.

So, what am I gonna do? I am going to share my small script so that you can save your time I you find my this article by Google search or any other search.

OK!
No more introduction. Let us start.

Download:

I suggest you first download the script and take a look.
http://www.tanzilo.com/demo/code/hide_show/hide_show.zip

Features:

  1. It is a totally CSS-based and table-less scripting
  2. I have used phpMailer version 2.3 and it works for PHP 5 and/or 6 version
  3. JavaScript used as you already know

CSS Code:

HTML Code:

JavaScript Code:

PHP Code:

Once again I would like to remind you that you first download this small script from the above download link and take a look at the whole script.

That is all for now, Dude!

Thank you for reading.

Jan 6, 2009 - PHP, Wordpress    12 Comments

WordPress: display posts by category ID. Solution with code & example.

Hello Guy!

Often in many blogging sites, you will see two or three columns of the most important categories. Recently I had to do this for a blog. It was a little bit cumbersome and time consuming. So, I would like to share the solution so that you can kill the time waste trying yourself in case you do not know how to do it. In this solution, I show 5 posts at maximum from my chosen three categories.

OK.
Let us start and let me show how to do it.

Step One: See the sample what would be the output

In the above image, you will notice that the first category has enough posts, so it can fetch 5 (five) posts for us. But in second column and third column, there are only three posts because those categories do not have more than three posts. And what I want to say at this point is – although we will try to get 5 posts from each category, we will not get enough in case that category has less than 5 (five) posts and this is done automatically.

Step Two: Adding custom function

Now open the functions.php file inside your theme directory and insert these two functions. If there is none, create a functions.php file. And at this point, please remember that all the functions and coding in this file are automatically added during the code execution.

Note that the function names are self descriptive.

Step Three: Embed code in your file(s)

Now open your footer.php file or any other file and add this code. In 99% cases, you may need to customize this small piece of code. The first three lines are category IDs.

Step Four: Link your CSS code

I have put the above CSS code in my style.css file. In 99% cases, you may need to customize according to your requirements.

Step Five: Test everything by opening the link

Now test you code and we are done!

Thank you for reading.