That's a typical tree structure, so just google for some solution that doesn't send dozens of queries: google: php tree structure.
Nested Set might be a perfect choice here as it allows you to easily retrieve the entire tree, a path to the specified node (root -> sub -> sub -> node) and elements had fixed positions within a tree.
I think the best is to cache your table of contents in a .html file instead of calling a script which will always return the same content. You just have to recreate the cache every time the table of contents is changed.
Would it be fair to say that the documentation is static between releases? If so, consider caching a static copy of the complete documentation in HTML.
You could also go half way, and serialize a PHP array to file when the table of contents is updated. The display page would then just include the file, and automagically have a variable with the tree structure.
发布评论
评论(3)
这是典型的树结构,因此只需谷歌搜索一些不会发送数十个查询的解决方案:google:php 树结构。
嵌套集可能是一个完美的选择,因为它允许您轻松检索整个树、路径到指定的节点(根 -> 子 -> 子 -> 节点),并且元素在树中具有固定位置。
That's a typical tree structure, so just google for some solution that doesn't send dozens of queries: google: php tree structure.
Nested Set might be a perfect choice here as it allows you to easily retrieve the entire tree, a path to the specified node (root -> sub -> sub -> node) and elements had fixed positions within a tree.
我认为最好的方法是将目录缓存在 .html 文件中,而不是调用始终返回相同内容的脚本。每次目录更改时,您只需重新创建缓存。
I think the best is to cache your table of contents in a .html file instead of calling a script which will always return the same content. You just have to recreate the cache every time the table of contents is changed.
文档...
可以公平地说文档在版本之间是静态的吗?
如果是这样,请考虑以 HTML 形式缓存完整文档的静态副本。
您也可以半途而废,在目录更新时将 PHP 数组序列化到文件。然后,显示页面将仅包含该文件,并自动具有具有树结构的变量。
Documentation...
Would it be fair to say that the documentation is static between releases?
If so, consider caching a static copy of the complete documentation in HTML.
You could also go half way, and serialize a PHP array to file when the table of contents is updated. The display page would then just include the file, and automagically have a variable with the tree structure.