How to store taxonomy for multiple scenarios

#1

Hello and i hope that you are having a pleasant day,

i need some wisdom for my taxonomy browser. I am building a nature website and i have implemented my own router framework. I’ve asked about this before and Sir Jim suggested a class file with an animal controller. I have arrived at this juncture with my own method but now i do not know how to proceed because i am not a database esigner and this may even belong in the php coding forums.

i now have a path to an animal page, such as Animalia/Arthropoda/Insecta.
this would be the equivalent of a query string for use in a class file or animal controller. I originally used directories and echo the basename for a breadcrumb title. Now i have the path, so i can explode it, count it and display a dynamic breadcrumb. Thus, i only need one php file to load appropriate content.

what needs to be done to accomplish this task: a breadcrumb title that will contain vernacular names instead of the latin used in the path. A page title using the last path as current file name. Load appropriate content for this current file.

thus, if the path is Animalia/Arthropoda/Insecta, then Insecta will load content for this class. That content will be order names: Hymenoptera, Orthoptera, Hemiptera, Diptera etc.

I need to use these names for multiple purposes: links to the actual content, the breadcrumb title, the page title and language translations.

if i store all of the latin names in a table, then how will i access them based upon what i need them for? in other words, Hymenoptera should only occur once in the database and i may need this name for display but also for translation into vernacular and also as the name of an image or the name of a variable or array. Hymenoptera will be used in a link context under insecta.

understand? i feel like i’m not making sense.
on the insecta page, i need the name of the orders to create links to virtual pages. so Hymenoptera needs to be displayed as a link. The title for this page is Insecta plus vernacular name. The breadcrumb doesn’t have Hymenoptera in it because the path is Animalia/Arthropda/Insecta. I only need Hymenoptera for the link. Yet i need to translate Animalia, Arthropoda and Insecta. I also need to create new variables for use with forms.

so i need a way to tell each page which names it should contain, then access these names in a database without creating a large amount of queries.

if i imagine the following page: Animalia/Arthropoda/Insecta. Then i could set a variable called $group. switch ($group) case ‘Insecta’ then $linkNames equal Hymenoptera, Orthoptera, Hemiptera, Diptera, etc. but $breadcrumb names equal $path (which is Animalia/Arthropda/Insecta). A switch will be too much here, yes?

this is alot of data that should be centralized, yet i don’t know how to centralize and access it based upon specific needs.

any suggestions?
i hope that i make sense. I’m sorry for the long post but i’m trying to explain the scenario as best as i can. I think that this may be a database design issue mixed with php for accessing the appropriate material.

Thanks.

#2

i think that this problem can best be described like this:

i currently have folders and files for the animal paths. so Animalia/Arthropda/Insecta is a real path outside of the root. in the Insecta folder is index.php. Index for Insecta has all of this data hardcoded. I realize that i could dynamically build the breadcrumb titles with the path which i have access to in the router. Because the included file has access to these variables in the calling file (router). Thus, $path = Animalia/Arthropda/Insecta. I could select each path from a database for translation but this will be three queries alone multiplied by the amount of users.

now insecta also has special content, which is links to the orders of this class. I need both latin and language/vernacular names. latin for the path and language for display. so six more queries? yikes! that will now be nine queries total multiplied by the amount of users.

yet, if i use a switch in a single index file/template, then this would be a large switch. should i just create content files based upon the path? or is it possible to centralize this data and not require 20 queries or more? is it okay to repeat data in the database for this? so instead of making an Insecta.php page, then store all relevant data from this page into a database table? i ask this because then the data is redundant. Hymenoptera would be listed twice allready for different reasons. so should i use files and php for this? or a database? but if a database, then i have no clue how to do this.

#3

How much of the view/template differs between the different classes?

This would be much easier to answer if one could have a look at it, at minimum screenshots of the class pages of insecta and another class.

Also you don’t need multiple queries to fetch the breadcrumbs. If you set the order/classes/etc up as categories you can rather easily query the data you need. And if each of the “categories” have both the normal name and the latin name you would get both without any issue.

1 Like
#4

so i solved this problem which stems from the breadcrumb titles by using a variable and an array with a loop. The title of every request page is now dynamic. I no longer have to code it manually. I can also translate using a function with an array except for genus and species (because both ranks can reach absurd numbers, such as 10,000. Thus a database will be used here.) I can also echo the current page name by using array pop on the path. So i am happy.

now i have a question about this process. I hope that this question is read. Maybe noone is checking this post anymore.

if i use one php file for all animal pages, is this a load balancing problem? should insecta be its own page or can i use a template file (single page with dynamic content)? i worry that 100 users traversing the animal kingdoms will slow the site down. so essentially, should i use one file or multiple files?

#5

One file.

A server is a multi-threaded process. Each Request gets it’s own thread.

Server implements a hybrid multi-process multi-threaded server. By using threads to serve requests, it is able to serve a large number of requests with fewer system resources than a process-based server. However, it retains much of the stability of a process-based server by keeping multiple processes available, each with many threads.

1 Like
#6

Thank you, Benanamen. I prefer one file. However, i am having trouble building dynamic session variables for use with this one file. Once i can solve my session variable problem, then i will have one file for all of my taxonomy.