D
D
dev4002016-07-17 19:48:22
Network administration
dev400, 2016-07-17 19:48:22

Ordinary constants, or constants in a class?

Let's say there is a constant with a domain. Make it an ordinary constant, or make it a constant in the view class, since it is used in templating. Is there a global difference? On the one hand, we store them anywhere, and on the other hand, they are stored in a class whose area of ​​responsibility corresponds to the logic of a constant

<link href="<?=HOST?>/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet" />

or
<link href="<?=View::HOST?>/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet" />

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Igor Krivintsov, 2016-02-07
@wizart23

The only guess is that the Kerio system from one branch checks the combination for the network 192.168.10.0 and as soon as there is such a combination on the other side, a tunnel is created, but for other networks .. there is no such combination, and it writes such errors in the logs .

I
index0h, 2016-07-18
@dev400

In a constant without a class - it's not worth it, view has nothing to do with it in principle. Typically, the domain is the configuration data for your environment/application. You can make a config class with your domain constant.
For good, in the generation of links by routes, a service (either as part of a router or a separate one) that already knows about your domain should be able to. And adding it by hand is not something that would be a bad practice, rather strange.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question