Last active
October 28, 2017 06:03
-
-
Save greenboyroy/757c345a5885293bde53 to your computer and use it in GitHub Desktop.
Revisions
-
greenboyroy revised this gist
Feb 10, 2016 . 2 changed files with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -41,7 +41,7 @@ //reset $current_letter and display glossary, adding heading letters as required $current_letter = ''; perch_content_custom('Glossary', [ 'template' => 'glossary_listing.html', 'sort' => 'title', 'sort-order' => 'ASC', 'each' => function($item) { File renamed without changes. -
greenboyroy renamed this gist
Feb 10, 2016 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
greenboyroy revised this gist
Feb 10, 2016 . 2 changed files with 14 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -19,6 +19,7 @@ 'sort-order' => 'ASC', 'each' => function($item) { $word = strtoupper($item['title']); // if the first letter of the title is different to current_letter, it's new so add it to nav_arr if (strcmp($word[0], $GLOBALS['current_letter']) !== 0) { $my_letter = $GLOBALS['current_letter'] = is_numeric($word[0]) ? '0-9' : $word[0]; $GLOBALS['nav_arr'][$my_letter] = '<a href="#glossary-'.$my_letter.'">'.$my_letter.'</a>'; @@ -45,6 +46,7 @@ 'sort-order' => 'ASC', 'each' => function($item) { $word = strtoupper($item['title']); // if the first letter of the title is different to current_letter, it's new so add it to the template if (strcmp($word[0], $GLOBALS['current_letter']) !== 0) { $item['letter'] = $GLOBALS['current_letter'] = is_numeric($word[0]) ? '0-9' : $word[0]; } 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ <perch:before><div class="group"></perch:before> <perch:if exists="letter"> <perch:if exists="perch_item_first"><perch:else /><a href="#top" class="glossary__top">Go to top</a></div><div class="group"></perch:if> <div class="glossary__letter"> <h2 id="glossary-<perch:content id="letter" />"><perch:content id="letter" /></h2> </div> </perch:if> <div id="<perch:content id="slug" type="slug" for="title" />" class="glossary__item"> <div class="glossary__term"><perch:content id="title" /></div> <div class="glossary__meaning"><perch:content id="desc" type="textarea" /></div> </div> <perch:after><a href="#top" class="glossary__top">Go to top</a></div></perch:after> -
greenboyroy revised this gist
Feb 10, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ // setup alphabet array for navigation // make array of letters in span tags $nav_arr = array( '0-9' => '<span>0-9</span>' ); for ($i = 65; $i <= 90; $i++) { $nav_arr[chr($i)] = '<span>'.chr($i).'</span>'; -
greenboyroy revised this gist
Feb 9, 2016 . No changes.There are no files selected for viewing
-
greenboyroy revised this gist
Feb 9, 2016 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,9 @@ <?php // setup alphabet array for navigation // make array of letters in span tags $nav_arr = array( '0-9' => '<span class="glossary-letter">0-9</span>' ); for ($i = 65; $i <= 90; $i++) { $nav_arr[chr($i)] = '<span>'.chr($i).'</span>'; } -
greenboyroy created this gist
Feb 9, 2016 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,54 @@ <main role="main" class="glossary"> <div class="group"> <?php // setup alphabet array for navigation // make array of letters in span tags $nav_arr = []; for ($i = 65; $i <= 90; $i++) { $nav_arr[chr($i)] = '<span>'.chr($i).'</span>'; } // Go through content, if an item title begins with a letter, make it into a link instead of a span. $current_letter = ''; perch_content_custom('Glossary', [ 'skip-template' => true, 'raw' => true, 'sort' => 'title', 'sort-order' => 'ASC', 'each' => function($item) { $word = strtoupper($item['title']); if (strcmp($word[0], $GLOBALS['current_letter']) !== 0) { $my_letter = $GLOBALS['current_letter'] = is_numeric($word[0]) ? '0-9' : $word[0]; $GLOBALS['nav_arr'][$my_letter] = '<a href="#glossary-'.$my_letter.'">'.$my_letter.'</a>'; } return $item; } ]); ?> <div class="glossary-nav"> <?php // Display our alphabet foreach ($nav_arr as $key => $value) { echo $value; } ?> </div> <hr> <?php //reset $current_letter and display glossary, adding heading letters as required $current_letter = ''; perch_content_custom('Glossary', [ 'template' => '_glossary_listing.html', 'sort' => 'title', 'sort-order' => 'ASC', 'each' => function($item) { $word = strtoupper($item['title']); if (strcmp($word[0], $GLOBALS['current_letter']) !== 0) { $item['letter'] = $GLOBALS['current_letter'] = is_numeric($word[0]) ? '0-9' : $word[0]; } return $item; } ]); ?> </div> </main>