I'm building a large dictionary of terms, MySQL-backed. Currently there are 3,223 entries in the database. I'm converting this into mobile format
for handheld devices (constrained screen real-estate, limited "browser" capabilities, etc.)
Due to the limitations of the screen size, I've been asked to create named anchors that will go from the top of the list of terms, down to the
next closest match of letters.
Each term displayed, would lack a <a name=".."> attribute unless its letter changed from the previous term's first two letters.
The first word to begin with "Be" would have an anchor that would put the user there when they selected it from the top of the page. It should
look something like this:
<a id="339" href="?term=Bay">Bay</a><br />
<a id="340" href="?term=Bay_Tree">Bay Tree</a><br />
<a id="341" href="?term=Bayonet">Bayonet</a><br />
<!-- Note that the anchor changes on this first "Be" word -->
<a id="342" href="?term=Beach" name="Be">Beach</a><br />
It all works right now, except adding the named anchors at their respective "first instance" of words that begin with $letter . [aeiou];.
How can I detect the change in the words, as I'm outputting them one by one from my results set?
Here's a sample of the words from the live db. I've added indicators below, where anchors would logically be inserted:
1930: Nails <-- #Na here
1941: Nearsighted <-- #Ne here
1963: Nickname <-- #Ni here
1972: Nobility <-- #No here
1982: Nuclear_Bomb <-- #Nu here
Thanks, my fellow monks.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] |