Global PHP template variable

  • Hello,

    I was trying to find solution for a few hours, but all threads I found are for old versions of WBB/WSF or are too complex and I am not able to understand it as of not well documentation.

    I need just one simple thing - use file_get_contents("url") in footer and header templates. Doing so directly as {@file_get_contents("url")} throws errors, so I came across threads that I need to create variable so I can use it as {@$myHTML}.

    As far I read I need make Template Event Listener, so I can hook to mentioned templates and then simply make PHP variable and pass it to template with assign.

    I understand whole AbstractPage happening as code here: Set Variables for a template

    I can not understand package structure how to implement this variable as global, for all pages. This gives some clue, but no idea how to deal with it: Globale Template-Variable?

    Great thanks in advance.


  • {"url"|file_get_contents} should work, our template engine is very similar to Smarty, the syntax is identical and it has almost the same features.

    Alexander Ebert
    Senior Developer WoltLab® GmbH