donglu4633 2014-01-17 04:48
浏览 46
已采纳

零售网站如何使用单个产品信息填充页面? [关闭]

This is a silly question and I will get some backlash for it, but I don't know how to ask the question in search bars, so I can't find the answer.

I'm trying to figure out how sites like ebay, pccasegear etc populate their product page with information about each specific item.

I know they obviously wouldn't have a html page for each product, which is ridiculous. So I assume they would have to have a single product page which was populated from a database by php or something like this.

My question is, how is this done? and how could I go about coding this without using php or using a database?

I ask this because I am required to code a website for my course, and it asks to have 12+ dummy products, and I do not want to create a html page for each product.

  • 写回答

1条回答 默认 最新

  • doudou0111 2014-01-17 04:50
    关注

    At a very high level: the data about each product is stored in a structured, computer-friendly format, not as HTML. Typically it will be stored in a database of some sort: SQL, NoSQL, whatever.

    The product data is programmatically turned into HTML on-the-fly using some sort of HTML templating. It doesn't take much imagination to see how this part works. There's some "skeleton" structure (the template) into which the specific product information is substituted, using some sort of special placeholders.

    Consider this totally-made-up template as an illustrative example:

    <h1> {{ product_name }}  </h1>
    <p> {{ product_description }} </p>
    

    – can you see where this is going?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染