Skip to content

Instantly share code, notes, and snippets.

@DevJohnC
Created June 25, 2012 22:40
Show Gist options
  • Select an option

  • Save DevJohnC/2991902 to your computer and use it in GitHub Desktop.

Select an option

Save DevJohnC/2991902 to your computer and use it in GitHub Desktop.
How templates should probably work
<html>
<head>
<title>Home :: <? Theme::store_name() ?></title>
</head>
<body>
<h1><? Theme::store_name() ?></h1>
<h2>Home</h2>
<p>Welcome to the store!</p>
<? // here specials are products flagged as on sale or something in the admin and the loop is provided by the system
if (Theme::hasProducts('specials')): while (Theme::hasProducts('specials')): Theme::theProduct(); ?>
echo '<h3>Specials</h3>';
<h4><a href="<? Theme::theUrl(); ?>"><? Theme::theName(); ?></a></h4>
<div><? Theme::productImage('thumbnail'); ?> </div>
<p><? Theme::productPrice(); ?> </p>
<button><? Theme::cartButton('buy-now' , 'learn-more'); ?>
<? endwhile; endif; ?>
<? // but here I want to look at something unique to this theme, maybe a highlighted category or w/e
Theme::productQuery('hats', 'category=hats');
if (Theme::hasProducts('hats')): while (Theme::hasProducts('hats')): Theme::theProduct(); ?>
echo '<h3>Hats are cool</h3>';
<h4><a href="<? Theme::theUrl(); ?>"><? Theme::theName(); ?></a></h4>
<div><? Theme::productImage('thumbnail'); ?> </div>
<p><? Theme::productPrice(); ?> </p>
<button><? Theme::cartButton('buy-now' , 'learn-more'); ?>
<? endwhile; endif; ?>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment