N
N
Nimbus19962021-02-24 15:14:42
AJAX
Nimbus1996, 2021-02-24 15:14:42

What is the best way to make blocks?

I have a project for the layout of an online store, there is a catalog page consisting of a sidebar with filters and a menu and a main part with products. The question is this: when you select an item in the sidebar, the products are replaced with other content, because. everything remains the same, only the right part with the goods is replaced by other content, and so, this is implemented using Ajax's, do I understand correctly how the layout should be done then? Make up two pages that will be completely identical and only the main part changes or make up one page and on the second only a piece of code that will be substituted into the main block? And the second question - how is the "load more" button implemented? After all, nothing happens to the page, just goods are added, are they also loaded from the server? How then to typeset, just make a link with this button,

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Ankhena, 2021-02-24
@Nimbus1996

If it is replaced by content of the same type (products were shown, then also products, then only others), then one page is enough for layout.
If the content type is different, such as text or a list of news, then these are two different pages.
In such cases, it is convenient to use template engines (pug, twig, nunjucks) or some include package for gulp. So that you don’t have to make changes to the same parts 100 times (header, footer, etc.)

How then to make up, just make a link with this button, and then the backender will set up the addition of a product when this button is clicked?

Yes exactly.
And check the layout for overflow so that nothing goes anywhere with a large number of goods.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question