经典 ASP:查询字符串处理程序
我很久以前就做过了,现在找不到这个功能了。它不应该太复杂,但我想知道在我再次执行此操作之前是否有任何新闻...
采取这个:
www.example.com?query=whatever&page=1
现在想象我按按钮到第 2 页,它将变成:
www.example.com?query=whatever&page=2
始终保留查询字符串的其余部分完好无损的。现在第 2 页上的图片 我按下按钮按日期排序,它应该变成:
www.example.com?query=whatever&page=1&order=date
问题是,在用于排序的 ASP 代码上,我不想处理所有其他查询字符串。因此,我需要一个函数来为我处理它,并且能够执行类似以下示例的操作:
<a href="?<%= add_querystring(qs, "order", "date") %>">date</a>
<a href="?<%= set_querystring(qs, "page", page + 1) %>">next page</a>
<a href="?<%= add_querystring(del_querystring(qs, "page"), "allpages") %>">all pages</a>
这只是如果我仍然找不到现成的解决方案,我将要做什么的初步想法......再说一次,只是想知道是否有任何新的东西可以以我还没有想象到的方式来处理这一切。
I've done this a long time ago, now I can't find the function. It shouldn't be too complicated, but I wonder if there's any news on this before I go and do it again...
Take this:
www.example.com?query=whatever&page=1
Now imagine I press button to page 2, it will become:
www.example.com?query=whatever&page=2
Always keeping the rest of the querystring intact. Now picture on page 2 I press the button to order by date, it should turn into:
www.example.com?query=whatever&page=1&order=date
Problem is, on the ASP code for ordering, I don't want to handle every other querystring. So I need a function to handle it for me and be able to do something like the following examples:
<a href="?<%= add_querystring(qs, "order", "date") %>">date</a>
<a href="?<%= set_querystring(qs, "page", page + 1) %>">next page</a>
<a href="?<%= add_querystring(del_querystring(qs, "page"), "allpages") %>">all pages</a>
This is just an initial idea of what I am going to do if I still can't find a ready solution... Again, just wondering if there's anything new out there to handle all this in ways I haven't even imagined yet.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果有人感兴趣,这是我昨天滚动的相当混乱的代码:
If it's of anyone's interest, here's the quite confusing code I rolled on yesterday: