How to extend XenForo_Template_Public::getRequiredCssUrl

Marcus

Well-known member
I want to manipulate the return value of XenForo_Template_Public::getRequiredCssUrl , how could I do that? The load_class listener does not work. And I am not sure which template I should manipulate to manipulate the return value of that function. Thanks!!
 
You can't.

The templating system doesn't really appear to be written with much interaction with the load_class listener framework, and makes heavy use of static methods & variables.

Excluding code edits;

The closest way, to achieve rewriting the Css Urls, is to use a post render template hook to zero out/replace the magic marker "<!--XenForo_Require:CSS-->". And then use tricks such as defining your own classes providing getters & setters for the protected static class members hidden deep in the templating system.
 
Hi Xon!

thanks so much for helping me understand the template system. So I guess to keep my code short I would have to do something like string_replace("css.php"...) which is faster than a regular expression.

So maybe I will just do a simple file edit, I already have a small bash script that runs after every upgrade :D
 
  • Like
Reactions: Xon
I learnt how to use sed and now I have a simple bash script that I execute after each upgrade. If if would also upgrade the file hashes, too so xenforo doesn't remind me of the changed files. It is really very easy to work with and I have all my file edits within that single bash script so it works as a simple file-change-documentation, too.
 
Top Bottom