Oh Lord, Not Another Template Generator

Wednesday 7 January 2009

As I mentioned, I am already working on template to work along side my content generator, I thought I would put my messy thoughts here!

This time its not so much a list, more just recent thoughts!

The idea is to be able to generate a random template at the click of a button. These templates will have placeholders ready for our saved data.

My initial plans where rather large, and then as I started to think more into it, I realized that a much simpler, but scalable so lotion would be required.

This generator (as well as the content generator) will not be run on the fly from a live box. To free up resources on the server, maintain some sort of standard (by being able to quickly review the final item), and to be able to decide how far I can take things (how fast the content drips, link building yahdeeyah.., they will be used to simply create everything needed to just upload to a server and do their thing, all the content and templating ready to roll.

Kinda like an outta the box, set and forget solution, minus all the marketing bullshit!

Idea 1: Using just a standard DW generated 2 col, header and footer fixed template, randomize everything about it! I mean everything! different style sheet name, use of attributes, random class and id names and numbers, spacing and indenting, and whatever else will not invalidate the markup. (yes, a clean and valid document helps! Just do not waste time linking to prove it!)

Start the script by deciding which style to use from a list of pre defined styles. Some coders will use tabs at the start new lines, or maybe just a space or 2, while others will have many lines between elements and sections. By thinking of as many ways to indent and format our html we are removing more footprints. This would maybe include 1 array such as:
$attribute_style[]='"'; # double quotes
$attribute_style[]="'"; # single quotes
$attribute_style[]="`"; # them things!
$attribute_style[]='';  # nothing!
$att_style = $attribute_style[array_rand($attribute_style)];
echo'<div class=".$att_style.$rand_class.$att_style"></div>;

Note: Do note, that changing the quotes in the DOCTYPE appears to invalid the markup! That's shit innit!

Using scraped images and GD we could try and build some kind of graphical header too, but the amount of editing and filtering would be too much effort, and ongoing too I feel. I generally only fuck around with a few niches so an evening with a big bong and photoshop can produce plenty of unique(my arse) graphics for mashing up into our generator.

This idea is pretty exhaustive and boring to code (big array, randomize it, big array, randomize it ..), and over time will only become too prone to leaving footprints (fingerprints, arseprints whatever you wanna call em!). Not to be written off though, as the concept of having random styles and formatting is the very essence of this generator!

Idea 2: Applying the Big bong approach again, this time we are getting into the template searching zone and downloading as many fresh templates as our lungs can handle! *Maybe write a script to notify of us new templates!

Using a script to grab a random template, we preg all the classes and ids from the .css and .html files and change them! Apply a bit of the randomization techniques mentioned in idea 1 to restyle it, then ...

... Shit! We need to add place holders in the right places for our data (articles, images, videos and other crap). If we are getting our templates from many sources then that just means that every one of them is going to be different!

We know for a fact that each template will have head tags, so we can add relevant meta tags if needed as well as add / remove anything else we see fit. We can assume that h1 will be used and hopefully h2, there is a chance they may always use .headerdiv and .footerdiv too, but a lot more common and relevant ground is needed. So, with a bit of digging round we may be able to find some decent sources that use a standard way of creating their stuff. I would rather target specific sites than waste resources and time going blind for anything and ending up with a fucked up end prodoct most of the time!

Once template sources have been found and and a few downloaded, a bit of randomising will decide which one to use, then preg'ing and randomizing again will take care of the placeholders and any crap we can add, edit or remove.

This idea requires lots of time sourcing the templates. Then we need to write a shit load of regexs for each source in order to clean up any prints. (maybe even remove it from our folder of templates we randomly chose from too!)

Idea 3: Make each template each time I need one, remembering at least once a day to wash, eat, watch porn, feed pet girlfriend and generally live on the human side!

<robotvoice style="dalek">I AM NOT A ROBOT</robotvoice>

Have got a whole day to myself this week, will put some code together all being well.