N
N
Nikolai Kolesnichenko2016-02-19 16:12:11
Drupal
Nikolai Kolesnichenko, 2016-02-19 16:12:11

How correct is it to display a node programmatically?

To be clear, I'm not a programmer. Mostly a coder.
For a couple of years of using drupal, I always used views, displayed fields in the admin panel and, for the most part, rarely climbed into the render($page['content'])code render($page['footer']).
Recently, I decided to try to find ways to completely programmatically output a node. And found!
The api describes several ways to type field_view_field(). So I liked it much more, but I wondered if this method was correct. Let me explain, the projects are mostly not very complicated, but a bunch of extra classes and wrappers has always been annoying. It became especially hard to strain after meeting with BEM.
Actually questions:
How correct is this conclusion when creating a topic?
Does performance suffer?
If you stumble upon such code, will you curse the previous developer?
Is it possible to completely abandon views and do everything programmatically? Does it make sense?
Don't drink too hard :)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Pupkin, 2016-02-19
@sakrab

I can't even imagine why it's like that. In any theme, in any block, the page has always used views and will always be used.
- Through views, by pressing a couple of buttons, you will display any node, any number, anywhere.
- To programmatically display blocks in different regions, you will spend a lot of time on the code.
- I would mother. I would sit and think why?
- Abandoning views, it's like probably abandoning all editors and writing code in a regular notepad in Windows What's the
point? What are the problems with the output?

A
afi13, 2016-02-19
@afi13

This can be done in standard ways:
https://drupalwatchdog.com/volume-2/issue-2/angry-...
Or copy the field.tpl.php template into your theme and remove unnecessary classes and divs

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question