1. [Flash 10 is required to watch video]

     

    I’m currently working on a project that involves the deployment of a large amount of technology. In that matter I developed a basic API we intend to use on mobile devices such as iPhones, here you’ll see my first tests concerning HTTP requests made asynchronously.

     
  2. image: download

    Here’s what I’m working on lately, I’ve kind of drifted since my last articles on how to make editable pages, but I’ll eventually make a part 2. Anyway this is the core DB structure of a blogging system I’m working on.

    Here’s what I’m working on lately, I’ve kind of drifted since my last articles on how to make editable pages, but I’ll eventually make a part 2. Anyway this is the core DB structure of a blogging system I’m working on.

     
  3. Search Engine Optimization is not a legitimate form of marketing. It should not be undertaken by people with brains or souls. If someone charges you for SEO, you have been conned.
    — Derek Powazek (http://powazek.com/)
     
  4. The www vs non-www dilemma…

    This one will be a short but important one, especially if you plan to start a web project or if you currently have one.

    Lately I’ve been working on a really nice project and I’ve been assigned (read assigned myself) to set up the web server (apache, version control software, project manager and so on…). In my swing I also set up the domains and I figured a couple of things to save time later, especially for SEO. But let’s cut to the chase, shall we?

    As I was configuring subdomains for private parts, I stumbled upon the case of the “www” subdomain. Let me explain, most of the website running on the web have a web address that looks either like this “http://www.example.com/” or “http://example.com” and sometimes both are available and display the same content (which is bad btw). Now one thing you should now if you’re not familiar w/ domains is that in reality the “www” before a website address is a subdomain of the main domain he is in front of, a subdomain either points to a different server or a specific place on the same server (that can be the same place as the main domain) as the main domain. Well, you might be thinking right now, okay but what’s your point?

    My point is that this “www” subdomain isn’t really “natural” for a particular domain, but heck it’s so widely used on the Internet you got to create that subdomain cause you don’t want your users to stumble upon on a 404 page when loading your web app/service w/ “www” in front of your domain. But this causes another problem when you set both your domain and your domain w/ the “www” subdomain to display the same page you open a door for search engine to index your site twice and this is really bad for SEO. So, what are the best practices there?

    It’s simple, you should always set a permanent redirection either from www to non-www or non-www to www. But there’s also one thing to keep in mind when doing domain redirections shorter is better. With that in mind, IMO you should always opt for the first solution (www to non-www).

    That’s it, if you want some more informations or react to this post please feel free to write a comment.

     
  5. Finding a way to build nice and editable webpages (Part 1)

    For a couple of weeks now, I’ve been working for a client who wants to have the ability to edit his webpages whenever he wants. Even if it sounds simple the tricky part is that his website is also in multiple languages. Back when I started programming three weeks ago I opted to write his pages in XML and then parse them with PHP but the website design is so complex it’s worse than hell. I have changed my XML schemas more than I can count and some parts of the website are still missing. So, this morning I decided to do some tests aside in order to step back a little bit from this mess and possibly solve the problems I have.

    Anyway, this morning I’ve rewritten once again my XML schemas in a more user-friendly way (cause my goal is to have a re-usable solution that I can eventually distribute) and decided to go on a totally different path by using XSL to layout my XML in HTML and using PHP as the XSLT Processor. Obviously after a couple hours of coding that works great (see the demo).

    As some of you may want to know a bit more about the tech behind this, I’m going to show you how I did it. FYI, if you want to do this you should have at least basic understanding of the following concepts:

    • XML / XML Namespaces
    • XPath
    • XSLT
    • PHP DOM

    Once you get past those prerequisites you should be able to understand what I’ve did. First of all I created a basic XML schema which is pretty simple, it consists on a simple tag that I called “object” and that has to have the attribute “class”. The attribute “class” is some kind of an alias for the HTML tags we’re going to parse thanks to XSLT. Then as HTML objects also have arguments I created a tag called “attr” that takes all the arguments our HTML tag will have (for some elements I also have created some custom tags but I’ll explain that soon enough). Now that I have explained the concept, let me show you in a simple example in the case we want to display an image.

    <object class=”image”>

    <attr style=”border: 1px solid #000000;” alt=”” />

    <source>/image/url/</source>

    </object>

    As you can see (and as I have mentioned it) this tag also have a child called “source” which is the location of your image. The other thing is that you can also make multiple “attr” tags for each arguments if you want. So, here’s how our demo page looks like with this schema (if you want more information please contact me via my twitter: @keeguon):

    Okay, now let’s move on the XSLT part, it’s basically a simple XSLT file with templates to format our “object” tags given their “class” into HTML and here’s an extract of what it looks like:

    Now, it’s time to link the XML and the XSL together, we’re going to use the server for this so this is made through PHP DOM and PHP XSLTProcessor. We load the XML and the XSL in two DOMDocument objects and then we use the XSLTProcessor to display the XML with our XSL Rules. Here’s the code (I have nested this into HTML5 code and there’s a little bit of jQuery for the image in the link):

    So that’s pretty sums up how it works. As cool as it is though it is not really editable and here’s the explanation. Even if we can parse the XML as HTML, the idea would be to edit it with a WYSIWYG Editor (TinyMCE in my case) and then save the modified data in the XML, the problem is that once the data is parsed in HTML there’s no easy way to retransform it into XML (at least not that I know of) which is problematic with this method. You can still go to the edit page I created though (you won’t be able to edit but it gives the idea of what I’m trying to do).

    I guess, there’s two ways I could solve this, either doing simple HTML files (let me remind you that the pages need to be in different languages, this is why data must be detached from the view) rather than using XML and include it with PHP or put the pages in a database (typically MySQL) with a “lang” column and the data formatted in HTML in a column from type “Longtext”. I’m going to investigate on those two solutions in the couples hours I have and I’ll write a second article on the solution (and how to implement it) I would have chosen.