Created
May 1, 2012 20:38
-
-
Save listenrightmeow/2571175 to your computer and use it in GitHub Desktop.
List module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php defined('SYSPATH') or die('No direct access allowed.'); | |
/* | |
* Author : Mike Dyer | |
* @Anchor.php | |
* | |
* @params : | |
* uri : anchor location | |
* title : anchor text | |
* attrs : valid anchor attributes | |
* | |
*/ | |
if(!isset($item) && !empty($item)) return 0; | |
$links = I18n::load('en-links'); | |
$messages = I18n::load('en-us'); | |
$attrs = isset($attributes) ? HTML::attributes($attrs) : NULL; | |
echo HTML::anchor($links[$item], $messages[$item], $attrs); | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en-US"> | |
<head> | |
<meta charset="utf-8"/> | |
<title>Wendy's Fresh Pic'd Summer</title> | |
<link rel="stylesheet" href="" /> | |
<script src="" type="text/javascript"></script> | |
</head> | |
<body> | |
<header> | |
<?= HTML::anchor($links['logo'], 'LOGO') ?> | |
<h1><?php echo $messages['site.title']; ?></h1> | |
<nav> | |
<?php | |
echo View::factory('modules/list', array( | |
'items' => array( 'nav.create', 'nav.find', 'nav.help', 'nav.home' ), | |
'list_id' => 'primary', | |
'list_class' => 'UTL', | |
'render' => array( | |
'path' => 'modules/anchor', | |
'attrs' => array( | |
'data-href' => '#test', | |
), | |
) | |
))->render(); | |
echo View::factory('modules/list', array( | |
'items' => array( 'nav.invite', 'nav.share' ), | |
'list_id' => 'social', | |
'list_class' => 'UTL', | |
'render' => array( | |
'path' => 'modules/anchor', | |
) | |
))->render(); | |
?> | |
</nav> | |
</header> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php defined('SYSPATH') or die('No direct access allowed.'); | |
return array( | |
'logo' => '#logo', | |
'nav.create' => '#create', | |
'nav.find' => '#find', | |
'nav.help' => '#help', | |
'nav.home' => '#home', | |
'nav.invite' => '#invite', | |
'nav.share' => '#share', | |
) | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Author : Mike Dyer | |
* @List.php | |
* | |
* @params : | |
* list_type : Defaults to UL if not provided | |
* list_class : List class | |
* list_id : List id | |
* list_attributes : Iterate over associative array for valid element attributes | |
* | |
*/ | |
if(!isset($items) && !empty($items)) return 0; | |
$item_class = isset($item_class) ? ' class="'.$item_class.'"' : ''; | |
$list_type = isset($list_type) ? $list_type : 'ul'; | |
$list_class = isset($list_class) ? ' class="'.$list_class.'"' : ''; | |
$list_id = isset($list_id) ? ' id="'.$list_id.'"' : ''; | |
$list_attr = ''; | |
if(isset($list_attributes)) { | |
foreach ($list_attributes as $key => $attr) { | |
$list_attr .= ' '. $key . '="' . $attr .'"'; | |
} | |
} | |
if(isset($render)) { | |
$attrs = isset($render['attrs']) ? $render['attrs'] : NULL; | |
} | |
?> | |
<?php | |
echo '<' . $list_type . $list_class . $list_id . $list_attr . '>'; | |
foreach ($items as $key => $item) { | |
if(isset($render)){ | |
$data = View::factory($render['path'], array( | |
'item' => $item, | |
'attrs' => $attrs, | |
)); | |
$item = $data->render(); | |
} | |
echo '<li' . $item_class . '>'. $item .'</li>'; | |
} | |
echo '</' . $list_type . '>'; | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php defined('SYSPATH') or die('No direct access allowed.'); | |
return array( | |
'nav.create' => 'Create', | |
'nav.find' => 'Find a Wendy's*', | |
'nav.help' => 'Help', | |
'nav.home' => 'Home', | |
'nav.invite' => 'Invite a friend', | |
'nav.share' => 'Share', | |
'site.title' => 'Fresh Pic'd Summer', | |
) | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment