0

I'm new to Symfony, but I believe I understand how routes and controllers work. I've played with the tutorials on their website and everything was going great. However, I am not able to do some (supposedly) very simple things and I can't find anything useful when googling. To be honest, I'm not even sure I'm using the proper terminology, which makes looking online difficult. Here's what I would like to do:

  • Use routes to point to files with HTML and display them. As I understand it, these files will be inside the public directory. What's the proper way to point to them from my controller class (see below).

e.g.:

class PageController
{

  /**
   * @Route("/")
   */
  public function homepage()
  {
    return new Response('location of home.php');
  }
}
  • Similarly, link to CSS and JS from within the HTML. That includes working with CSS frameworks such as Bulma - which is installed in node_modules, outside the public directory. How do I manage that?

In a project without Symfony, my links on the document head look like this:

 href="img/favicon.png"

 href="node_modules/bulma/css/bulma.css"

 href="css/style.css"

How do I manage those now?

How do I apply what I already know about designing websites to Symfony?

Julles
  • 41
  • 9

1 Answers1

0

normaly you need to return a file "twig", like for exemple: return $this->render('your_file_ruter/locationOfHome.html.twig')

waner
  • 57
  • 1
  • 10
  • Supposing I have some HTML ready, I'd have to use within twig? Also, what happens to the links to stylesheets, etc? – Julles Mar 21 '18 at 19:20
  • twig can support HTML text (twig its like a HTML type for symfony ). so all your html text add it in a twig file like ' locationOfHome.html.twig ' . and if you want use "css" do something like " " and " href="{{ asset('favicon.ico') }}" – waner Mar 21 '18 at 19:29