I’m not sure, but I think we’re finally close to getting this figured out. On Thursday we both off and on tried our best to tackle this problem. It got so bad that I finally had to post more cries for help on the Codeigniter forum website. We got some more “uh, you could try this. It might work” suggestions. As of today, this is where things stand:
The new Model:
The model now contains two functions for the database, one for the categories and one for the Terms/Definitions.
The new Controller (now in the welcome.php file):
The controller now has the new function calls. We moved it to the welcome.php file because this is where all the major controlling happens.
The new View:
Now, both the categories and terms/definitions have foreach loops to print out the respected items one time each.
The new Glossary page in the site:
Now all the category links that are active are displayed above the Terms/Definitions.
This is a big accomplishment for us. No longer do we get one hundred and three category links or only twenty-six terms/definitions. The next step is to create a third function that takes all the cat_ids in the Glossary table that match with the ids in the gloss_categories table. All the cat_ids and the ids have been Inner Joined to take care of this issue. This was also the reason why we kept getting the one hundred and three links with one function.
Basically what this does is it goes row by row of the Glossary table and matches the cat_ids up with the gloss_categories ids.
It then combines them into one result table. We plan on using this new table to pull the Terms/Definitions when the specific category link is clicked. It would go and match up the two id columns, then return the matching Terms/Definitions. It also only displays the active (categories with terms and definitions) on the webpage. We’re in the home stretch with this. I know that I’m now way behind schedule, but this war has to be won.