This may be a weird type of question, but how would you generate square links which have their size based on how many links the next page contains. The amount of links would be generate using this:\[code\]$directory = "directory/subdirectory1/";$files = glob($directory . "*");$count = 0;foreach($files as $file){ if(is_dir($file)) { count++; }}\[/code\]So lets say that in the folder directory we had 6 sub-directories names subdirectory1 - 6, for each directory we would find out how many directories each one has and then store this in an array.From this we can start generating the squares. Everything should be done based on percentages, so we don't need to worry about absolutes. They shouldn't have like tiny sizes. So lets say \[code\]subdirectory1\[/code\] had 18 directories in it, \[code\]subdirectory2\[/code\] had 15, \[code\]subdirectory3\[/code\] had 12, \[code\]subdirectory4\[/code\] had 9, \[code\]subdirectory5\[/code\] had 6, and \[code\]subdirectory6\[/code\] had 2In this situation its obvious that \[code\]subdirectory1\[/code\] should be the biggest, so that should be 50% of the page, then \[code\]subdirectory2\[/code\], \[code\]subdirectory3\[/code\] and \[code\]subdirectory4\[/code\] have very similar amounts, so I would say split them across the other 50% by having half the height of \[code\]subdirectory1\[/code\] and putting \[code\]subdirectory4\[/code\] on the next line, then the last 2 would be 25% each of that line, resulting in something like this:
But how could I cater for any ratios of directories, any algorithms that could help me out? This needs to be able to accommodate 30+ different sub-directories.Thanks for your time