Wednesday, April 8, 2009

External HTML (dynamic menu anyone?)

A simple technique I have implemented after some research (and confirmation that YES in fact it is SEO search friendly):

I have a external javascript file with my menu structure (menu_structure.js) that is included in my menu
for each of the 100+ html pages as such:



my menu_structure.js file looks a little like this (I have truncated and murdered it so I'm not showing 2 million lines):

document.write('');

its super simple and straight forward, make a javascript file that uses the DOM to document.write your html code that is the menu structure and include that file in every html page; rock and roll! now when you want to add/delete a menu item you can edit menu_structure.js rather that 100+ html pages *gasp!*. NOTE: my menu has a multitude of javascript functions and CSS styles that are also external files, this blog simply tells how to include the structure; peace!

Wednesday, March 25, 2009

Force array to be a set of 3 (or any integer) and navigate in a loop

var offersRaw:Array = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13];

var offers:Array = [];

offerCap = Math.floor(offersRaw.length/3)*3;

for (i=0; i<=offerCap; i++) {
offers.push(offersRaw[i]);
}

var itemIndex0:Number = 0;
var itemIndex1:Number = 1;
var itemIndex2:Number = 2;
var itemIndex3:Number = 3;
var itemIndex4:Number = 4;
var itemIndex5:Number = 5;
var itemIndex6:Number = 6;
var itemIndex7:Number = 7;
var itemIndex8:Number = 8;




zero.text = offers[itemIndex0];
one.text = offers[itemIndex1];
two.text = offers[itemIndex2];
three.text = offers[itemIndex3];
four.text = offers[itemIndex4];
five.text = offers[itemIndex5];
six.text = offers[itemIndex6];
seven.text = offers[itemIndex7];
eight.text = offers[itemIndex8];


right.onPress = function() {

moveForward();

};



left.onPress = function() {

moveBackward();

};

function moveForward() {

itemIndex0 = itemIndex0+3;
itemIndex1 = itemIndex1+3;
itemIndex2 = itemIndex2+3;
itemIndex3 = itemIndex3+3;
itemIndex4 = itemIndex4+3;
itemIndex5 = itemIndex5+3;
itemIndex6 = itemIndex6+3;
itemIndex7 = itemIndex7+3;
itemIndex8 = itemIndex8+3;

if (itemIndex0>offerCap) {
itemIndex0 = 0;
}
if (itemIndex1>offerCap) {
itemIndex1 = 1;
}
if (itemIndex2>offerCap) {
itemIndex2 = 2;
}
if (itemIndex3>offerCap) {
itemIndex3 = 0;
}
if (itemIndex4>offerCap) {
itemIndex4 = 1;
}
if (itemIndex5>offerCap) {
itemIndex5 = 2;
}
if (itemIndex6>offerCap) {
itemIndex6 = 0;
}
if (itemIndex7>offerCap) {
itemIndex7 = 1;
}
if (itemIndex8>offerCap) {
itemIndex8 = 2;
}

updateProducts();

}

function updateProducts() {

zero.text = offers[itemIndex0];
one.text = offers[itemIndex1];
two.text = offers[itemIndex2];
three.text = offers[itemIndex3];
four.text = offers[itemIndex4];
five.text = offers[itemIndex5];
six.text = offers[itemIndex6];
seven.text = offers[itemIndex7];
eight.text = offers[itemIndex8];
}


function moveBackward() {

itemIndex0 = itemIndex0-3;
itemIndex1 = itemIndex1-3;
itemIndex2 = itemIndex2-3;
itemIndex3 = itemIndex3-3;
itemIndex4 = itemIndex4-3;
itemIndex5 = itemIndex5-3;
itemIndex6 = itemIndex6-3;
itemIndex7 = itemIndex7-3;
itemIndex8 = itemIndex8-3;

if (itemIndex0<0) {
itemIndex0 = offerCap-2;
}
if (itemIndex1<0) {
itemIndex1 = offerCap-1;
}
if (itemIndex2<0) {
itemIndex2 = offerCap;
}
if (itemIndex3<0) {
itemIndex3 = offerCap-2;
}
if (itemIndex4<0) {
itemIndex4 = offerCap-1;
}
if (itemIndex5<0) {
itemIndex5 = offerCap;
}
if (itemIndex6<0) {
itemIndex6 = offerCap-2;
}
if (itemIndex7<0) {
itemIndex7 = offerCap-1;
}
if (itemIndex8<0) {
itemIndex8 = offerCap;
}

trace(itemIndex0);

updateProducts();


}

Monday, September 8, 2008

Crossdomain.xml

Security. Flash was built with security in mind, and therefore needs to use other web languages to access information on other websites.

So lets say you find yourself in a situation where you need to keep the files that contain these other languages on a external server (ie. the flash file is on one server, the XML file is on another server, and your images that are being indexed by the XML file are on yet another server). One example of this is a published Advertisement or flash application on the clients server (of which you have no access), that you would like to update on the fly with no access to their server.

In comes crossdomain.xml:












This is it. Host this on the external server in the same directory as the XML file that is being accessed. This gives permission for flash to pull files from a external server. NOTE: the above code give COMPLETE access, and could pose a security risk, this is defined here:


You can specify specific directories where the "*" is, such as:



Popular sites such as yelp, and flickr have a completely open crossdomain.xml file, an interesting article on the security issues posed by this is here:

http://blog.monstuff.com/archives/000302.html

Thank you, have a nice day.

Sunday, August 10, 2008

and then there's positioning

Where would we be without positioning?! Your furniture would be on the ceiling and cat flying on the back of a seagull, who knows?!



Static: This is default, and need not be set generally



Relative: This positioning method refers to the items position relative to the positioning characteristics of the container it rests in. If it is plopped right in the body, than its the same as static



Absolute: this bugger has a strong hand, swiping away all the opposing forces and declaring "THIS IS WHERE I AM, AND NOBODY CAN TELL ME WHAT TO DO!"



Floating: Floating is a nifty little thing, it is what brings us above the lowly old-world programmers that rely on tables instead of DIVs, and likely have 24k dial up modems. Floating is especially handy in creating columns, for instance if you wanted a three column layout you could create 1 main container, and 2 containers within it, the first of these two would contain your left and center columns, and than the third right column would float outside of this inner container directly within the main (see diagramn)



Sunday, August 3, 2008

ok, i did it! embed dynamic yelp reviews to a website in 5 minutes flat

Voila! After much fruitless searching and cursing SEO's around the world I have stumbled upon a disgustingly simple process for posting specific business reviews from yelp to a website.



A New Hope:
If you don't have Firefox than discontinue reading this blog and push your computer out the nearest window. If you do than high five!

(plugins you should download NOW!! Web Developer, DownloadHelper and Tamper)

Navigate to the Yelp page containing the business reviews you wish to stream into your website, if you are running the latest Firefox you will notice a little icon like this appear next to the web address (on Safari the letters RSS are next to the web address, zeus only knows what IE does):



Click on this RSS feed icon, than copy the URL of the page it va

what the hells an RSS feed?! check out this to clear the fog:




The Empire Strikes Back:
Navigate to a page such as: http://grazr.com/ follow the steps to creating a customized RSS reader (an RSS reader will except the .xml URL you had copied above and display the dynamic content... watch the video!!)



Return of the Jedi
After you've completed customized fiddling and otherwise wasting your time on grazr.com creating your RSS reader and plugging in your .xml RSS feed copy the HTML EMBED code from grazr where you've created your reader, now paste this inbetween the body tags on your website and VOILA!! May the feed be with you

Monday, July 28, 2008

willy nilly. i put a few pixels to work

stipper stipper, i will force my css upon thee!

What a wonderful idea, if only I had the ability to apply my CSS files to anyones page, imagine the possibilities! It would be like that part in 12 Monkey's where the zoo has been unleashed on the city and Highway 1 is clogged with giraffes!

So, practically speaking, I would begin my external CSS adventure by applying [laserclownsfrommars.css] to John McCains main website, and perhaps [doubledragonbellyflop.css] to various intelectual sites around the web. Oh, wiki would get some love too, and google.

This may all seem like non sense, but it is (not)! CSS style sheets take the data you put on a website and organize, arrange, beautify, and even (in John McCains circumstances) apply little videos of Laser Clowns From Mars all of the site blasting your quotes and quips.





End factor: semantic markup is useful, fairly cool and makes for logical CSS files that will be easier to use in a team environment and gives the ability to swap and conquer.