I have a page that lists over 100 items and I need to dynamically add a name="" tags to the beginning of each new section of items that starts with the next alphabet.
For example:
<a name="a"></a>
<h1>Amazon River</h1>
<h1>Arrow Heads</h1>
<a name="b"></a>
<h1>Bear Claws</h1>
<h1>Bee Traps</h1>
<h1>Dodge Ball</h1>
<a name="f"></a>
<h1>Football Players</h1>
<h1>Fig Newtons</h1>
....
<a name="y"></a>
<h1>Yorktown</h1>
<h1>Yikes</h1>
<a name="z"></a>
<h1>Zebra</h1>
<h1>Zoo Mobile</h1>
I am only familiar w/ php, somewhat familiar w/ javascript, not sure what one it would take to accomplish this.
I will type out the "code" in theory, so you have an idea of what I want to accomplish
$letter = range(a-z);
if($title == first_letter_character($letter)) {
print '<a name="'.$letter.'"></a>';
$letter++; // goes to next letter in range
}
Also, there may be some letters that may not have an item.
Any help is appreciated.