\n

World Cup 2014 soccer ball, Adidas Brazuca

I did some coding yesterday to run a 2014 World Cup confidence pool on SportsFilter. The way a confidence pool works is you assign points to teams based on how confident you are they will win. In this contest, you get point values from 32 down to 1 and assign them to the 32 World Cup teams. The more points you assign a team, the more you are awarded when that team wins or ties a match.

Anyone can sign up for a SportsFilter account and play. A prize will be awarded to the winner: the Adidas replica version of the official World Cup ball. The deadline for entries is shortly before the first match Thursday.

I wrote the web application in PHP, stored the database in MySQL and used the Smarty PHP template engine for the presentation. This was a project I had to complete in a single day, so I didn't think I'd go to the trouble of using Smarty. I figured I would just kludge together some ugly PHP pages that had code and HTML markup mixed together.

But Smarty makes it easier to present the HTML output of a PHP web application. I find that I write better PHP code when I use it and there's less debugging required to get things right.

The way Smarty works is you write a PHP script that does the work such as collecting user input and storing data, make some variables from that script available to Smarty and tell it to load a template file that contains HTML and some simple code to present information.

Here's the last part of the script that displays the contest entry form and validates what the user has submitted:

// make data available to templates
$smarty->assign('spofi', $spofi);
$smarty->assign('page_title', "Enter the SportsFilter World Cup 2014 Confidence Pool");
$smarty->assign('spofi', $spofi);
$smarty->assign('form_output', $form_output);
$smarty->assign('error_message', $error_message);
$smarty->assign('random_team', $random_team);
$smarty->assign('submit_widget', $submit_widget);

// display output
$smarty->display('header.tpl');
$smarty->display('confidence-pool.tpl');
$smarty->display('footer.tpl');

Those three .tpl files are templates. The header and footer contain the SportsFilter layout and the main body of the page is in confidence-pool.tpl.

Here's a portion of that template:

{$error_message}
<p><form action="/confidence-pool.php" method="post">
{$form_output}
<input type="submit" value="Preview My Entry" name="command">
{$submit_widget}
</form>

Smarty's template language can do more than display variables. It has for loops to display every element in an array and formatting functions that can do things such as control how the elements of a date are displayed.

I also used it on Wargames.Com. Here's some template code from the state directory pages:

{foreach from=$stores item=store}
<p class="directorystore">
<span class="directorystorename"><a href="{$store.link}">{$store.name}</a><br /></span>
{if $store.phone neq ''}<span class="directorystorephone">{$store.phone}<br /></span>{/if}
<span class="directorystorelocation">{$store.city}, {$store.statename} {$store.zip}<br /></span>
</p>
{/foreach}

The $stores variable is an array with link, name, phone, city, statename and zip elements.

The ultimate goal of today's project is to make it possible for a website's users to create and run their own confidence pools for any sporting event that lends itself to this type of contest. One sport it would be ideal for is the NFL, with players ranking the teams playing that weekend and competing all season.

-- Rogers Cadenhead

Comments

It should not be difficult to find pools in which actual money changes hands. Anyone who claims to know the competition is rigged is perfectly free to put their money where their mouth is and place bets consistent with this alleged inside information.


 

QUICKBOOKS PAYROLL SUPPORT PHONE NUMBER @ +1-833-441-8848 BRINGS THE MOST RELIABLE AND AFFORDABLE TECHNICAL ASSISTANCE FOR QUICKBOOKS PAYROLL AT COMFORT OF YOUR HOME.

QUICKBOOKS PAYROLL SUPPORT PHONE NUMBER
QUICKBOOKS PAYROLL SUPPORT PHONE NUMBER
QUICKBOOKS PAYROLL SUPPORT PHONE NUMBER


 

QUICKBOOKS PAYROLL SUPPORT PHONE NUMBER @ +1-833-441-8848 BRINGS THE MOST RELIABLE AND AFFORDABLE TECHNICAL ASSISTANCE FOR QUICKBOOKS PAYROLL AT COMFORT OF YOUR HOME.
QUICKBOOKS PAYROLL SUPPORT PHONE NUMBER
QUICKBOOKS PAYROLL SUPPORT PHONE NUMBER
QUICKBOOKS PAYROLL SUPPORT PHONE NUMBER


 

Give a perfect companion to your payroll accounting available on just a call.Dial Phone Number for QuickBooks Payroll Support Number 1-833-441-8848 and avail the on-demand customer priority support for QuickBooks Payroll at comfort of your home.Visit
PHONE NUMBER FOR QUICKBOOKS PAYROLL SUPPORT
PHONE NUMBER FOR QUICKBOOKS PAYROLL SUPPORT


 

Give a perfect companion to your payroll accounting available on just a call.Dial Phone Number for QuickBooks Payroll Support Number 1-833-441-8848 and avail the on-demand customer priority support for QuickBooks Payroll at comfort of your home.Visit
PHONE NUMBER FOR QUICKBOOKS PAYROLL SUPPORT
PHONE NUMBER FOR QUICKBOOKS PAYROLL SUPPORT
PHONE NUMBER FOR QUICKBOOKS PAYROLL SUPPORT


 

QuickBooks Payroll Support Phone Number +1 888-238-7409 is here to help you fix the QuickBooks payroll setbacks with technical troubleshooting by experts

QUICKBOOKS PAYROLL SUPPORT PHONE NUMBER
QUICKBOOKS PAYROLL SUPPORT PHONE NUMBER
QUICKBOOKS PAYROLL SUPPORT PHONE NUMBER


 

This blog is very nice.I really like such a fantastic written blog.I will keep coming here again and again.Visit my link as well. epic battle simulator pc


 

no more QuickBooks error swill be able to trouble you. yes, QuickBooks support phone number 1-833-441-8848 provides immediate technical resolution of QuickBooks errors that prevents the error from reoccurring. Also, they deliver the smart technical assistance for QuickBooks software at comfort of your home.

QuickBooks support phone number
QuickBooks support phone number
QuickBooks support phone number


 

Dial QuickBooks Desktop Support Phone Number 1 888-238-7409 to get the most effective technical assistance for QuickBooks from verified QuickBooks experts.
QuickBooks Desktop Support Phone Number
QuickBooks Desktop Support Phone Number
QuickBooks Desktop Support Phone Number


 

QuickBooks Support Phone Number is also playing a great role from decades. Yes, whenever you encounter any kind of technical error in QuickBooks, our technical team is here at 1-833-441-8848 to help you get rid of such errors in minimum time.

QuickBooks support phone number
QuickBooks support phone number
QuickBooks support phone number


 

Dial QuickBooks enterprise support phone number 1-888-238-7409 to get connected with one of our technical specialists immediately for technical support in QB
QuickBooks enterprise support phone number
QuickBooks Enterprise Solutions
QuickBooks enterprise support


 

Looking for technical assistance for QuickBooks ? Unable to install QuickBooks on your own? If yes the call us today at Contact Number for QuickBooks Support 1-833-441-8848 and unlock the benefits of unlimited technical assistance for QuickBooks provide by experts available round the clock to assist you.

Contact Number for QuickBooks Support
Contact Number for QuickBooks Support


 

QuickBooks Enterprise errors troubling you? No more QuickBooks Enterprise issues will be able to annoy you .Yes,because QuickBooks Enterprise Support Phone Number 1-833-441-8848 brings the smartest technical assistance for QuickBooks Enterprise software at comfort of your home.Our experts are well-aware with the QuickBooks Enterprise software and its issues.

QuickBooks Enterprise Support Phone Number
QuickBooks Enterprise Support Phone Number


 

Phone Number for Quickbooks Payroll Support +1-833-441-8848 is assisted by our amazing support team. We take care of every issue that gets triggered in QuickBooks Payroll and its versions. Issues like failure of QuickBooks Payroll update, error in reinstalling QuickBooks etc. are solved quite easily by our technical support team. The best part is that our services can be availed 24*7 by QuickBooks users across the planet.

Phone Number for Quickbooks Payroll Support
Phone Number for Quickbooks Payroll Support


 

QUICKBOOKS SUPPORT PHONE NUMBER

DIAL QUICKBOOKS SUPPORT PHONE NUMBER +1-844-235-3996 IS THE PERFECT CHOICE TO SEEK TECHNICAL HELP FOR QUICKBOOKS FROM WELL-EXPERIENCED AND CERTIFIED QUICKBOOKS EXPERTS THAT ARE AVAIL ROUND THE CLOCK.

QUICKBOOKS SUPPORT PHONE NUMBER

QUICKBOOKS SUPPORT PHONE NUMBER

QUICKBOOKS SUPPORT PHONE NUMBER


 

QUICKBOOKS SUPPORT PHONE NUMBER

DIAL QUICKBOOKS SUPPORT PHONE NUMBER +1-844-235-3996 IS THE PERFECT CHOICE TO SEEK TECHNICAL HELP FOR QUICKBOOKS FROM WELL-EXPERIENCED AND CERTIFIED QUICKBOOKS EXPERTS THAT ARE AVAIL ROUND THE CLOCK.

QUICKBOOKS SUPPORT PHONE NUMBER

QUICKBOOKS SUPPORT PHONE NUMBER

QUICKBOOKS SUPPORT PHONE NUMBER


 

Add a Comment

These HTML tags are permitted: p, b, i, a, and blockquote. A comment may not include more than three links. Participants in this discussion should note the site's moderation policy.