We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Little problem when returning content with Phalcon\Mvc\User\Component

Why Component, when used in <head>, works great for <link> and <script>, but not <meta>? (I mean, CSS and JS works, but it isn't in UTF-8)



98.9k

Phalcon\Mvc\User\Component does not have any functionality related to the generation of <link> and <script>



33.8k

I mean that you can set links and scripts directly in the view, or get them by Component, and you get the same result: both loads correctly in the page (and you've your CSS and JS working in the client). But it isn't the same with meta, I don't know why.



98.9k

Could you please elaborate?



33.8k

Let's imagine that you have generic.js for all the views in your application (with a function that gets the result of the sum of two numbers, for example). You can set it manually in each of then, or use, in your head, a function of the Component class to only call it in the views and make life millions time easier (it will return the script). Both of them will work; this means that calling the sum function, using one way or other to get that JS, will get you the sum of the two numbers. The function will be available always.

So, using one way or another, anything you want will work well. The problem is that meta doesn't attend to this; it just doesn't work.

(PD: sorry for being late, was doing other things with my views).