如何确保用户创建新项目时,将创建新页面? [英] How do I make sure when my user create a new item, new page will be created?

查看:51
本文介绍了如何确保用户创建新项目时,将创建新页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



所以我创建了一个像ebay这样的网站,用户可以在我们的网站上发布自己的东西。

我想问的是,我想确保每次用户在我们的网站上发布他们的项目时,都会为该页面生成一个新的链接/页面。



这是人们如何做到这一点的常见方式吗?

我想在每次用户发布内容时动态创建一个新页面,但是在将来的某个页面中它不会是很多页面吗? br $> b $ b

谢谢。



我的尝试:



....................................... .................................................. .....................

Hello everyone,

So I am creating a website something like ebay where user can post their own stuff on our website.
What I want to ask is, I want to make sure that everytime the user post their item on our website, a new link/page will be generated for that page.

Is that common way of how people do it?
I was thinking create a new page dynamically every time the user post stuff, but wouldnt it be lots of pages in our system later in the future?

Thanks.

What I have tried:

..............................................................................................................

推荐答案

这不是怎么做的,不,人们使用提到的技术作为路由。所以我可能有一个名为product.aspx的页面显示产品,然后我会有一些机制在网址中查找特定的模式。所以网址可能是



/ books / TheBible



当确定不是物理页面,分析从第一段提取类别,从第二段提取产品。然后代码将找出哪个类别书籍(比如数据库中的类别100),然后它会找到标记为TheBible的产品,其类别为100(比如数据库中的产品1234)。现在它的产品实际上会处理一个页面,比如



product.aspx?id = 1234



所以网址上写着/ books / TheBible,但实际显示的是product.aspx?id = 1234。这样,当有人创建一本名为哈利波特的书时,它在数据库中被标记为具有HarryPotter的网址段,当有人导航到/ books / HarryPotter时,它们会显示为product.aspx?id = 1235。因此,不需要创建实际页面。这也意味着如果我想更改产品页面的布局,我只需要在一个地方进行。



如何实现这些不同的机制取决于技术你用来运行你的网站。
That's not how it's done, no, people use techniques referred to as "routing". So I might have a page called "product.aspx" that shows the product, and I will then have some mechanism that looks for a particular pattern in the url. So the url might be

/books/TheBible

when it is determined that isn't a physical page, it is analysed to extract the category from the first segment and the product from the second. The code will then find out which category "books" is (say category 100 in your database), then it will find the product marked "TheBible" that has a category of 100 (say product 1234 in your database). Now it has the product it will actually process a page like

product.aspx?id=1234

So the url says "/books/TheBible" but what is actually being shown is "product.aspx?id=1234". That way when someone creates a book called "Harry Potter" it is tagged in the database as having a url segment of "HarryPotter" and when someone navigates to "/books/HarryPotter" they are shown product.aspx?id=1235. So no actual pages need to be created. This also means if I want to change the layout of my product page I only need to do it in one place.

How you achieve these various mechanics depends on the tech you are using to run your website.


这篇关于如何确保用户创建新项目时,将创建新页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆