# I need to improve my fragmention code for related posts as I've realised I haven't accounted for multiple links to the same words. Currently, it only links back to the last instance processed so I need to think of a way to list multiple instances.
- It's going to be trickier than I thought.
# After completely rewriting the bi-directional links code and repeatedly breaking the single post page (I'm glad I took a backup as I had to start from scratch at one point) I think I've finally cracked it. Switching back and forth between PHP and JavaScript can be annoying.
If there is only one post linking to a fragment that text just becomes a direct link back out. If, however, more than one post links to the same fragment the text becomes the toggle for a container which, when clicked, lists all links, like this:
I'll pretty it up a bit at some later stage.
It should cater for multiple fragments in a post and multiple links to each fragment but I'll only find out how robust it is when I have more fragmentions to work with.
Where appropriate, I intend to cross-reference a lot more than I have in the past now that this system is in place.