Showing posts with label XML. Show all posts
Showing posts with label XML. Show all posts

Wednesday, 19 January 2011

jQuery Transitions


So the last couple of days have been a mammoth exercise in taking on new knowledge. It's all to do with learning the necessary bit and pieces to make the new TerrificArt website (see previous post).

I wanted to have auto-complete with suggestions from an XML file on the form for adding artworks. This meant delving into AJAX in the midst of teaching myself how to handle reading and writing XML files. Fortunately it turns out AJAX isn't that tough, but especially not when you use a library call jQuery with it.

jQuery also does a whole bunch of other neat tricks, like animating your transitions. The code snippet below shows the new largely jQuery code used to hide and reveal the navigation bar on richswebarchive.com, commented out beneath each function is the old code which achieved the same results but somewhat abruptly.

function menuOff() { 
 document.getElementById('hDivider1').style.display='none';
 $('#content').animate({
  left: '2%',
  }, 300, function() {
  // Animation complete.
 });
 $('#navigation').fadeOut("slow");
 $('#pagelinks').fadeOut("slow");
 $('#hDivider2').fadeIn("slow");
//  document.getElementById("content").style.left="2%";
//  document.getElementById('navigation').style.display='none';
//  document.getElementById('hDivider1').style.display='none';
//  document.getElementById('hDivider2').style.display='';
//  document.getElementById('pagelinks').style.display='none';
 }

 function menuOn() {
 $('#content').animate({
  left: '26%',
  }, 300, function() {
  // Animation complete.
 });
 $('#navigation').fadeIn("slow");
 $('#pagelinks').fadeIn("slow");
 $('#hDivider2').fadeOut("slow");
 $('#hDivider1').fadeIn("slow");

//  document.getElementById("content").style.left="26%";
//  document.getElementById('navigation').style.display='';
//  document.getElementById('hDivider1').style.display='';
//  document.getElementById('hDivider2').style.display='none';
//  document.getElementById('pagelinks').style.display='';
}

I'm not going to get into explaining it all here. For information abouy jQuery a great place to start is api.jquery.com. Also extremely useful in setting up my form for TerrificArt was this page at www.malsup.com which is well worth a look at.

Of course you need to include the jQuery libraries for this to work. It's a good idea to load them from Google, as lots of sites do this so they'll more than likely already be cached. Use this code:

<script type="text/javascript" language="javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"> </script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"> </script> 
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.8/jquery-ui.min.js"> </script> 

Monday, 17 January 2011

New Website to Write!

Great news! One of the best ways to learn, and definitely one of the best ways to teach yourself, is with real-world, practical situations. In many ways this blog and it's sister website are an excuse to do just that.

Even better though, someone has just asked me to re-write their whole site for them. The existing site is called www.terrificart.net. It's going to be a great way to learn a whole bunch of new things:

  • Site Design
  • Dealing with images
  • User-editable dynamic content
  • Slick, dynamic menus
  • XML
  • Advertising
  • Transactions

Site Design


I'm not going to go crazy here as I'm no designer. I just want something which looks fresh, modern and above all simple, intuitive and easy to use.

Dealing With Images


Right now I could write what I know about this on a stamp, so there's a long way to go. Obviously the images and there presentation is absolutely key to this project. I'll be looking to make cool slide-shows, expanding pop-outs and the like. I'm also interested in getting the images cached early for slicker usage.

User-editable dynamic content


Another key element in the design of the site. I want to set up a couple of forms where the site's owners can edit, add and delete artworks on the site.

Slick Dynamic Menus


As the content is dynamic the menus will need to be to.

XML


The key to managing the dynamic content and menus will be the use of XML. I'm hoping to use one simple XML element definition to refer to the artworks listed on the site. There is a massive amount of learning to do here, not just the XML itself but also the JAVA that handles the XML element(s) I set up.

Advertising


I want to get some simple advertising working on the site - again a totally new area for me.

Transactions


I want people to be able to order directly from the site and this will come when everything else is in place. Again, I have no idea about this just now, but I'm going to learn.


So there is an immense amount of learning to do here. I'm going to start with the XML, get my structure defined and some JAVA functions defined to access and modify the XML elements. Next up I'll probably look at the image handling and then the menus. Once these three main areas are sorted I should have the bones of a working site.

At this stage I'll take a look at the general design and feel of the site, like I said earlier - not going too mad. After that it's a case of bolting on the advertising and transactions.

It's going to take a while I reckon.