March 28, 2006

Providing front end developers reference to Smarty Vars

You will find other articles relevant to this document in these sections:
Cameron Manderson @ 12:12 pm

Working in MVC/Smarty we often have to communicate to the front end designer/developer the variables and datatypes that they can access. If not they need to crack open our PHP and locate each $smarty->assign() call to identify the template var and the datatype. Once they have located it, they usually have to analyse the data structure to see how it is formed, usually through a call to {$myTemplateVar|@print_r}.

A much simpler way of doing this is to setup a seperate “developer mode” that uses a different TPL that automatically print_r on all your template vars. This way the front end developer no longer needs to crack open your Action/ActionForm PHP code (containing your smarty->assign()) or performing print_r() through their frontend code.

When working in MVC (model2) we are treating the page actions as OO, not as procedural code (model1). The benefit of this is that our smarty->display() call is centralised to one location (our ActionDispatcher). This allows us to have control of loading a different template or inject variables for every action that is performed.

eg.

$requestURI = ‘my-page.tpl’;

// Determine the template to load
if(array_key_exists(’devmode’, $request->parameters) && $_SERVER[’REMOTE_ADDR’] == ‘127.0.0.1′) {
$smarty->assign_by_ref(’smartyVars’, $smarty->get_template_vars());
ob_start();
$smarty->display(’smarty-sniff.tpl’);
$pageBuff = ob_get_contents();
ob_end_clean();
} else {
$templateStyleController = TemplateStyler::getInstance();
ob_start();
$smarty->display(($templateStyleController->notEmpty() ? $templateStyleController->getTemplatePrefix() : “”) . $requestURI);
$pageBuff = ob_get_contents();
ob_end_clean();
}

// Return our HTML to display to the client
return $pageBuff;

We can therefore maintain our TPL’s in the following manor:

tpl/template1/my-page.tpl
tpl/template2/my-page.tpl
tpl/smarty-sniff.tpl
We can control which template to load by accessing from our Singleton Class TemplateStyler which contains application logic to determine which template to load.

Our smarty-sniff.tpl contains < <<

< pre >
{$smartyVars|@print_r}
< /pre >

>>>

When a developer is developing a page, they may want to see what information is available to them for each action they are performing. Therefore, they can do so by injecting a $_GET variable “devmode” into the request:

http://localhost/mySite/?do=myPage&devmode=1

Our ActionDispatcher will identify that they wish to view the data avialable to the front end and load the smarty-sniff.tpl which will nicely print_r all their smarty information for the action being performed, quickly being able to identify how to access data in the smarty template var structure.

Microsoft annouces Office 2007 delay

You will find other articles relevant to this document in these sections:
Cameron Manderson @ 8:36 am

CNet reports: “Fresh on the heels of a delay in broad availability of Windows Vista, Microsoft confirmed late Thursday in the United States that it is also pushing the mainstream launch of Office 2007 to next year.”

View the article here.

Maybe they are not trying to rush the market with a product that hasn’t been tested? No, that wouldn’t be it.

March 27, 2006

Adding additional behaviour to IE - LI Hover/Rollover

You will find other articles relevant to this document in these sections:
Cameron Manderson @ 4:59 pm

Most of the time, it is good practice to create lists using the UL/OL HTML tags so that their structure is represented in HTML (important). We are also incouraged to use nested UL/OL to display Hierarchy between the elements. A ‘no better’ example to this is either a site navigation, or a sitemap.

You HTML should form something similar to below:

  • About Us
    • Our Business
    • Our People
  • Products
    • Product ABC
    • Product XYZ
  • Services
    • Full List
  • Contact
  • Sitemap

This way your navigation already indicates the hierarchy of information using the LIST elements.
Now that we have created a nice hierarchal menu, we want to be able to have rollovers and cool effects, because the designer always have cool effects. Usually using A:Hover will be enough, but definately is not suitable for more complex lists.

Natively, MSIE 6 does not support the behaviour for LI Hover. There are some suitable hacks out there which help us add this behaviour by including them in the header of your page. One examples of adding this behaviour to other elements in MSIE is documented here at XS4ALL. But is this really compliant? What about earlier versions of IE? And what happens to Mac IE?
This method works by adding a .htc file to your website you can refer to it by including a reference in your IE header section body { behavior:url(”Hovers.htc”); }
Therefore all your styling is done in style sheets (Our aim). This behaviour can also be applied to TR, TD or whatever you require.

I have seen this used with my favourite little navigation code written by Aleksandar Vacić (A+) and can be found here.

XBox 360, I’m impressed

You will find other articles relevant to this document in these sections:
Cameron Manderson @ 9:08 am

I went into EB on the weekend and saw the new XBox 360 on display, with a couple of minors playing a car racing game.. I have to say, I was very impressed. Once again, as I always seem to find, EB staff are very hard to catch on a Saturday, always answering random questions by kids about upcoming games, and they never really have the time for people considering purchasing equipment.

The XBox HD images look stunning, set in 720P mode is enough. Having two controllers that are both wireless is a great feature. We can sit out on my balcony looking through the window and play, which ads to the social atmosphere. The menu system works really cool, they have obviously spent quite a bit of time making the menu systems look really groovy. It can have a wireless upgrade or plug it into your network, and can easily load your media from a computer (works better with the windows mediacenter O/S). The hard disk is removable (the 20gb hard disk ends up with about 13gb free after the O/S(?) and I imagine there is a game demo in there somewhere (haven’t found it yet)). The controllers also indicate with an LED which player you are (eg, player 1,2 etc) which is pretty neat, and when you turn on the controller it pops up saying you have signed in. I am not 100% sure yet but I think your profiles stay with your controller, as it says “cameron” has signed in when I turn on mine :-) . The controllers come with standard AA (Energiser) batteries (non lithium) but you can buy recharable AA’s or a XBox addon with allows it to charge the unit while playing via a cable to the box (into the USB2.0 ports).

I have been playing the Tom Clancy Ghost(?) game which is a shooter/strategy game (allowing you to switch between true first person or semi third person [like tomb raider]). The graphics look unbelievable, the Lighting is stunning all HDR and everything just looks so great. It looks superb on a 32″ LCD I must say. My friends aproved of it, and instead of playing poker saturday night as planned, the night ended up trying to control a team of guys with a blackhawk UH-60f trying to raid an enemy post.

So far I would have to say that the game is really enjoyable and is the kind of game you can chip away at the campaign quite happily. I am eager to have a look at Amped3 as I have liked all the other games in the series, and imagine the graphics would be stunning this time over.

Anyways all thumbs up, and would think the unit would be a big plus in a Home entertainment setup. Ethernet would probably be the go, and you can play all your DivX’s/Mp3’s etc at your tele. See you later Home Theatre PC’s (for the mean time, until the power of the system falls to far behind).

March 24, 2006

Some funnies

You will find other articles relevant to this document in these sections:
Richard Lee @ 1:40 pm

Where’s my Nano?

You will find other articles relevant to this document in these sections:
Richard Lee @ 1:33 pm

I ordered an iPOD Nano the other day with a shield case and today a shoebox-sized package arrived from Apple. I open up the package and covered in hundreds of “peanuts” was the Nano shield, but no Nano. Now when you consider the size of the case in contrast to the package you can understand why the Postal Service guy burst out in laughter. I’m sure Planet Ark would have a field day over this sort of wastage.

Come on Apple where’s your sense of corporate responsibility to the environment!?

Sun Grid hit by network attack

You will find other articles relevant to this document in these sections:
Cameron Manderson @ 12:26 pm

BuilderAU reported about a DoS attach on the publicly available Sun Grid - “To let people try out the Sun Grid, the company made a text-to-speech translation service publicly accessible for, for example, turning blog entries into podcasts. “It became the focus of a denial of service attack,” said Aisling MacRunnels, Sun’s senior director of utility computing said in an interview.”

Read the article here.

Browser Widths

You will find other articles relevant to this document in these sections:
Richard Lee @ 11:43 am

Since the dawn of time web designers have had to deal with screen resolution and the width of browsers. There’s nothing more annoying than unwanted horizontal scrollbars.

Below is a table of common browser inner-widths that i have created over time:

Browser Resolution Inner width (px)
Firefox 800×600 792
IE 5+ Win 800×600 ~780
IE 5 Mac 800×600 ~748
IE 4.5 Mac 800×600 ~744
Netscape 6+ Win 800×600 ~775
Netscape 6.2 Mac 800×600 ~763
Firefox 1024×768 1016
IE 5+ Win 1024×768 ~1004
IE 5 Mac 1024×768 ~972
IE 4.5 Mac 1024×768 ~968

March 23, 2006

Dell acquires Alienware

You will find other articles relevant to this document in these sections:
Richard Lee @ 4:14 pm

There were rumours in the gaming community and finally it’s come true, News.com today announced Dell’s acquisition of Alienware.

It’s a strange one alright, who would have thought Alienware, a boutqiue company who specializes in exotic designs and colourful systems would pair up with a big corporate supplier like Dell?
Alienware has been marketed for a long time as a technology-driven company that understands the needs of gamers, while Dell on the other hand comes across as a big corporate supplier of office PC’s and work stations.

I really wonder what affect this will have on Dell’s XPS range of gaming and multimedia PC’s.

Sources:

http://news.com.com/Dell+to+acquire+Alienware/2100-1003_3-6052842.html?tag=nefd.top

http://news.com.com/2061-10810_3-6049829.html?tag=nl

TheAge reports: Xbox targets a wider audience

You will find other articles relevant to this document in these sections:
Cameron Manderson @ 8:45 am

View the article.

“A NEW battle for the hearts and wallets of passionate gamers begins today with the launch of Microsoft’s Xbox 360 console.

“The 360 also signals the start of a lengthy fight for control over how we consume other digital media, such as music and video.

“Microsoft describes 360’s longawaited debut as “the biggest console launch in the history of the Australian market”, but consumers face a difficult decision whether to buy now or wait for rival next-generation systems from Sony and Nintendo.

« Previous PageNext Page »