T
T
Timur Kalimullin2014-11-19 19:36:52
PHP
Timur Kalimullin, 2014-11-19 19:36:52

What is the best way to implement a component for 1C-Bitrix?

Good afternoon,
a module for uploading data from crm to Bitrix infoblocks is being created.
It is necessary to write a component to display the received information.
Bitrix:news is quite suitable, but you need to add your own fields for input parameters (via the visual editor) for data settings in the template.
What is better to do:
1. Your bike using api. And there will be almost a copy of bitrix:news
2. Extend the bitrix:news component using .parameters.php in the template. But what is the best thing to do, because the module will not be installed on 1 site.
3. Is there another solution?
Perhaps it is worth copying a pre-prepared template for the bitrix:news component to the /bitrix/templates/#name#/components/bitrix/news folder when installing the module so as not to write a separate almost identical component?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Emelyanov, 2014-11-19
@babarun

If you only need to change the template, and the complex news component itself suits, then why reinvent the nuclear bicycle? Add everything you need to .parameters.php, and if you need to refine the logic later, then result_modifier.php and component_epilog.php will help you.
Well, you guess right, when installing the module, copy your template to the default site template, just in case, add a prefix in the name of the news template - the name of the module.

M
Maxim Morozov, 2014-11-20
@murzix

It is better to create your template in your own namespace. Pluses following:
1. It is simpler to develop a component. No need to use crutches like result_modifier.php
2. No unnecessary requests to the API, and therefore to the database.
3. The purpose of the component is much clearer, bitrix:news is a news output component. Do you have news there?
Component template files should only be copied to the site template if they are site-specific and inseparable from it. If the component is universal, then it is easier to implement a universal .default template in the component folder, which can be included on any template of any site without copying anything anywhere.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question