UltraMega Blog
11Oct/1086

Create an Upload Progress Bar With PHP and jQuery

When it comes to uploading files, users expect visual feedback, usually in the form of a progress bar. The problem is that PHP doesn’t offer a way to track file uploads in progress by default. Fortunately, there is an extension that enables this functionality and this tutorial will show how it can be combined with jQuery UI to create a progress bar.

Here is a demo of the effect we will be building in this tutorial:

21Jul/095

Modifying Templates Using DOMDocument In PHP

In the previous post, Generating HTML5 Documents Using DOMDocument In PHP, we explored the PHP DOMDocument class by generating an HTML5 page completely within PHP. Now, we'll look at a more practical application that involves modifying an existing template. The template gives us a good starting point so we can focus on generating only the dynamic parts of the page.

Tagged as: , , Continue reading
14Jul/099

Generating HTML5 Documents Using DOMDocument In PHP

PHP 5 includes a powerful set of DOM manipulation classes that gives you full control over HTML and XML documents. This functionality behaves very similar to JavaScript's DOM manipulation engine. In this tutorial, we'll explore the DOMDocument class by generating an entire HTML5 page without writing a single bit of raw markup. This may not be practical for most applications, but it should give you a good idea of how the basic DOMDocument methods work.

Tagged as: , , Continue reading
25Jun/0934

Create a Slide-In Panel with jQuery

In this tutorial, I'll explain how to create a slide-in panel effect with jQuery. Basically, this means a hidden panel the slides into view when it is triggered by a button or other action. This is often used to display a contact form in a fun way, which is exactly what I am using it for on the new UltraMega website. As it turns out, this is very easy to do.

View Demo

7Apr/099

Creating a BBCode Parser

Have you ever wanted to implement BBCode, the special formatting codes used by forums, into your own PHP scripts? Well, it's actually pretty easy to accomplish using some simple regular expressions and the preg_replace PHP function. This mini-tutorial will show you how to create a function that you can use on any string to convert BBCode into its XHTML equivalent.

The advantage to using BBCode instead of allowing XHTML in user input is that it allows users to safely format their content without the risk of invalid code breaking the page formatting. It also tends to be easier to understand BBCode over XHTML due to its simplified syntax.

3Apr/090

How To Center a Page With CSS

When designing the layout of a web page, it is common to want to center the entire page. Luckily, this is very easy to do without breaking standards. All you have to do is wrap the entire page with a div with the left and right margins set to auto (margin: 0px auto;).

Here is an example:

<html>
<body>
<div class="wrapper">Contents of page...</div>
</body>
</html>
.wrapper {
   margin: 0px auto;
   width: 600px;
}

Here, margin specifies the top/bottom and the left/right respectively.

That's all there is to it!