Answer the question
In order to leave comments, you need to log in
Is it possible to insert a component into the detail view page (News)?
Subject. I want to display the latest materials from the section, under each news.
But in my case, it should be inside the detailed view of the news itself.
The component code is not converted to a component. Which exit?
Answer the question
In order to leave comments, you need to log in
I don’t know all the nuances of your task, but I see three ways to solve it:
1. Create an IB property of type text, put the component code in it, and in the template do an eval of the content of this property, if it is not empty. It is fraught with runtime errors and the component code will only be inserted at a predetermined location in the template, i.e. in the middle of the news it will not be possible to insert it.
2. In the detailed description, right in the text of the news, where you need to insert the component, place a tag, for example: PATH_TO_FILE, place the component code in the file, and replace this tag in the template with the result of executing the file with the component. The downside of this solution is a potential php injection.
3. The first two methods can be combined: store the component code in the holy IS, and place a tag or label (for example, #COMPONENT_HERE#) in the news text where it needs to be inserted.
If you want the latest materials under each news, then why do you need to insert the component code into the element itself?
If this is a complex component, then paste it in detail.php, if it is a normal one, then in component_epilog.php.
The component code is not converted to a component.What?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question