Month: April 2008

Embed Quicktime Movie

Embedding a Quicktime movie player into your webpage work similarly to embedding Flash files, making use of the OBJECT, EMBED and PARAM tags inside your HTML code. You can play .MOV, .MP4 and .MPEG files with the embedded Quicktime movie player. As you might know (or have noticed), the Internet Explorer 7 rendering engine “blocks” these OBJECT tags and require a user to first activate the object by clicking on it. There is a workaround though and it requires some Javascript code which I’ll discuss in this post. So I’ll start off by showing you the Javascript function which will write the necessary HTML to the page. function embed_quicktime(filename) { if (filename != "") { document.write(''); } } The code above is a simple Javascript function which will take a filename or full file URL as its first and only parameter. The parameter will be used as the value of the SRC attribute inside both the first PARAM tag and then of course the EMBED tag as well. You’ll need to execute this Javascript function from within your HTML page where you need to have the Quicktime movie player embedded with the specified file. See the HTML example below. In the HEAD section, you will notice a SCRIPT tag which references an external Javascript file. This is the file containing the embed_quicktime() function I just showed you to previously....

Read More

HTML : Option Groups/Sections

Have you ever wanted/needed to create a select drop down menu with options divided into sub-sections or groups with labels? See the screenshot below. You can easily achieve this with HTML by wrapping OPTION tags inside a SELECT tag with an OPTGROUP tag, each with a label attribute in order to create the group caption or label. See the sample code below. Option 01 Option 02 Option 03 Option 04 Option 05 Option 06 Option 07 Option 08 Option...

Read More

PHP : Strip filename from a URL

Using PHP, you might need to strip the path from a URL, leaving behind just the filename at the end of the URL. You can achieve this with a regular expression pattern of course, but I have a much simpler solution. See the example code below. $url = "http://www.domain.com/path/to/file/filename.php"; $filename = basename($url); echo $filename; //filename.php And that’s all there is to it. I hope that you found this...

Read More

iTunes podCast Categories SQL

I am busy writing a podCast plugin for WordPress and figured that it would be most efficient if I created a Category model which will hold all the podCast feed categories which can be specified in the feed specifically for the iTunes store. The SQL code creates a database table named “categories” and inserts all the podCast categories available in the iTunes store, together with appropriate parent and child associations. You’ll notice a “parent_id” field which tells you what the ID of the parent of each individual category is. Of course, those with a 0 value in the “parent_id” field are main/top level categories. You can either copy and paste the code below or download the attached zip file. It is recommended that you download the zip archive since the code below might give you encoding issues as a result of both WordPress and the copy/pasting procedure. I hope that you find this useful! Download : iTunes Podcast_Categories SQL CREATE TABLE `categories` (  `id` INT(11) NOT NULL AUTO_INCREMENT,  `title` VARCHAR(100) NOT NULL DEFAULT '',  `parent_id` INT(11) NOT NULL DEFAULT '0',  `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',  `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',  PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=1;   INSERT INTO `categories` (`id`, `title`, `parent_id`) VALUES ('1', 'Arts', '0'); INSERT INTO `categories` (`id`, `title`, `parent_id`) VALUES ('2', 'Business', '0'); INSERT INTO `categories` (`id`, `title`, `parent_id`) VALUES ('3', 'Comedy',...

Read More

JavaScript : Increment & Decrement Variable Values

Using Javascript, you might want to define a variable when a page is loaded and change the value of that specific variable throughout the period of the interaction of the user with the page. You can define a variable in the HEAD section of the page like this : var number = 1; Then, you might want to increment or decrement the value when a button or a link is clicked or another event is fired. I’ll show you an example, using a button to fire a custom function I’ll be showing you shortly. Here is a button in our page : <input type="button" name="mybutton" value="Click Me" onclick="change_number('inc');" /> As you’ll notice, I put an onclick attribute inside the button tags and inserted a value which tells the page to fire a javascript function called change_number when the button is clicked. This function can either be defined in your HEAD section or in an externally referenced file. The first parameter passed to the function is simply a value I’m using so that I can utilize the same function for both incrementing and decrementing our variable. “inc” will represent incrementing the value of the variable and “dec” will indicate that the variable needs to be decremented. Below is our custom javascript function : function change_number(way) { //check if we should increment or decrement     if (way == "inc") { //two...

Read More

Pin It on Pinterest

Subscribe To Our Newsletter

Subscribe To Our Newsletter

Join our mailing list to receive the latest news and updates from our team.

You have Successfully Subscribed!