How do you solve quot;unstructuredquot; navigation in PHP?(你如何解决“非结构化问题?PHP中的导航?)
问题描述
我有一个大型的、基于 PHP 的 CMS 来管理网页.所有项目都以树状结构组织.当我编辑一个项目时,返回"按钮通常指向它的父项目.因此,通常的工作流程是在树中导航.
I have a large, PHP-based CMS that manages web pages. All items are organized in a tree structure. When I edit an item, the "back" button usually points to its parent item. So, the usual workflow is navigating through the tree.
时不时地,需要一种跳转"到其他项目而不考虑结构的工作流.
Now every now and then, the need arises for a workflow that "jumps" to other items without regard for the structure.
例如,当用户编辑网页时,他们可能希望打开该页面所附加到的模板(完全不同分支中的另一个项目),在那里进行更改,然后单击保存"时期望返回他们正在编辑的页面.
For example, when a user is editing a web page, they may want to open the template the page is attached to (another item in a completely different branch), make a change there, and when clicking "save" expect to come back to the page they were editing.
目前,我解决了这个问题
At the moment, I solve this using
domain.com/admin/template/edit?from=/frontpage/edit
from"变量决定保存"和取消"按钮的目标 URL.
where the "from" variable determines the target URLs of the "save" and "cancel" buttons.
当路径变得太长和太复杂时,这一直有效.例如,如果用户
This works up to a certain point when the path becomes too long and complex. For example, what if the user
- 编辑页面
- 打开附加的模板
- 在前端视图中预览该模板
- 然后希望无缝返回到他们正在编辑的页面?
现在,历史"在最后一项结束,所以当用户从前端视图返回时,原始页面的链接丢失了,他们必须手动搜索.
Right now, the "history" ends at the last item so that when the user returns from the front-end view, the link to the original page is lost, and they have to search it by hand.
另一个可能很快发生的问题是包含所有from"值的 GET URL 变得太长,或者完全混乱:
Another problem that can happen quickly is that the GET URL containing all the "from" values becomes too long, or totally chaotic:
domain.com/admin/template/edit?from=/frontpage/edit&from=/somepage/edit
&from=/template/preview&/from=template/edit&/from=template_preview ...
(你明白了)
过去我通过打开单独的窗口优雅地解决了这个问题,但我真的很想实现一个通用的无缝单窗口工作流程,主要是因为多个窗口往往会使用户感到困惑.
I have solved this elegantly by opening separate windows in the past, but I really want to implement a seamless one-window workflow that works universally, mainly because multiple windows tend to confuse users.
你如何解决这个问题?
您是否实现了一个健壮的非结构化"导航,在打开多个窗口(=一个用户使用不同的导航路径做多个不同的事情)时效果很好?
您如何在用户界面方面解决这个问题?
我能想到的最佳方法是传递指向数据库或会话中临时记录的来自"值.该记录包含有关当前路径的所有信息,因此始终可以提供正确的返回第 x 页"值.
The best approach I can think of is passing on a "from" value that points to a temporary record in a database or session. That record contains all the information about the current path, and can thus always provide the right "back to page x" value.
我最想听到的是那些成功实施这一点的人的经验,以及他们是如何做到的.
What I would like to hear most is experiences from people who have successfully implemented this, and how they did it.
推荐答案
只是一些建议
预览问题:在 IFRAME 中预览,所以历史不会丢失?
Preview Problem: preview in an IFRAME, so the history doean't get lost?
混乱的 URL 问题:如果每个页面都有某种键,而不是 URL 路径
Cluttered URL problem: If you have some sort of key for each page, other than the URL path
(i.e. /frontpage/edit = 952,
/frontpage/edit&from=/somepage/edit = 763,
/template/preview = 651,
template/edit = 612,
template_preview = 866 etc.)
您可以像这样在 PATH_INFO 中将它们串在一起:
you could string them together in the PATH_INFO like so:
domain.com/admin/template/edit/952/763/651/612/866
这篇关于你如何解决“非结构化"问题?PHP中的导航?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:你如何解决“非结构化"问题?PHP中的导航?
基础教程推荐
- mysqli_insert_id 是否有可能在高流量应用程序中返回 2021-01-01
- 在 PHP 中强制下载文件 - 在 Joomla 框架内 2022-01-01
- 超薄框架REST服务两次获得输出 2022-01-01
- WooCommerce 中选定产品类别的自定义产品价格后缀 2021-01-01
- 通过 PHP SoapClient 请求发送原始 XML 2021-01-01
- Libpuzzle 索引数百万张图片? 2022-01-01
- XAMPP 服务器不加载 CSS 文件 2022-01-01
- 在多维数组中查找最大值 2021-01-01
- 如何在 PHP 中的请求之间持久化对象 2022-01-01
- 在 Woocommerce 中根据运输方式和付款方式添加费用 2021-01-01