Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

With regard to templating approaches, my favorite by a very wide margin is to simply use string interpolation in the base language.

You create a common template type with methods like:

  LayoutHtml(Session? Session, string title, string innerHtml, ...) => $@"
  <html>
  (common elements)
  {innerHtml}
  (common elements)
  </html>";
Which is then fed html partial snippets generated however you see fit. The use of methods to abstract partials in a hierarchical fashion like this can manage complex layouts well. You can recurse and compose this structure as much as needed (i.e., partials inside partials).



It looks like PHP is ideal.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: