开发者

Any way to reduce repetitive markup in webpages or something like caching such frequently used markup?

开发者 https://www.devze.com 2023-04-02 17:46 出处:网络
When you have the same set of buttons on each item row of a long list of items. Is ther开发者_StackOverflow中文版e any way to reduce the markup (of repeated elements on the page)? Any way to make it m

When you have the same set of buttons on each item row of a long list of items. Is ther开发者_StackOverflow中文版e any way to reduce the markup (of repeated elements on the page)? Any way to make it more efficient ?

Is there any facility to cache that kind of markup like CSS or js files. I am looking out for this solution for a web 2.0 site.

Edit

Not looking for a server side solution, as I am already aware of those. I am bascially concerned about reducing file size of my webpages transferred to user's browser.


There are a few ways:

  1. Generate the HTML using a server-side language (PHP, ASP, etc) and use loops to create the repetitive markup

  2. Create the markup in Javascript, inserting elements into the DOM via a loop.

  3. Use a template to provide the markup, and include the template as many times as needed.

0

精彩评论

暂无评论...
验证码 换一张
取 消