XF 2.0 Versioning included javascript files

jkilbride

Member
I have an external javascript file I am including with a template modification of the helper_js_global template. I'm using something like this right below the <!--XF:JS--> comment:

Code:
<xf:js src="/js/my/addon/my-file.min.js"></xf:js>

Everything is working correctly, but I noticed that all the other javascript files are being versioned while mine is not. (e.g. /js/xf/core-compiled.js?_v=21ab4cbe). Is there an easy way to automatically version my javascript file?
 
HTML:
<script src="{{js_url('my/addon/my-file.min.js')}}"></script>
Or
HTML:
<xf:js src="{{js_url('my/addon/my-file.min.js')}}" />
 
Well, just look into helper_js_global
HTML:
    <xf:set var="$cssUrls" value="{{ ['public:normalize.css', 'public:core.less', $app . ':app.less'] }}" />

    <xf:if is="$xf.options.fontAwesomeSource == 'local'">
        <xf:set var="$cssUrls" value="{{ array_merge($cssUrls, ['public:font_awesome.css']) }}" />
        <link rel="preload" href="{{ base_url('styles/fonts/fa/fontawesome-webfont.woff2?v=' . $faVer) }}" as="font" type="font/woff2" crossorigin="anonymous" />
    </xf:if>

    <link rel="stylesheet" href="{{ css_url($cssUrls) }}" />
 
Thanks again!

Sure would be nice if this stuff was actually documented somewhere, instead of having to search the forums and dig through the code...
 
Gemerally the code itself, if well written, is the best documentation you can have. XenForo is very well structured and once you've worked yourself into it and bring the required php knowledge with you, you'll find maneuvering through the code and finding information very easy. If you're looking for XF template syntax, you go to XF\Templater\Template\Tags (or similar, this is from my head) and check the files there, their names are the available tags and you can check them for supported arguments. If you need all template functions, you can find the list inside the XF\Template\Templater, listed nice and clean, prefixed with fn.

Fwiw, there is a dev doc that everyone can contribute to, but it obviously doesn't write itself and I gotta be honest, I rather have the devs improve the software than document every piece of it. That stuff can be done step by step by the community.
 
I'm sorry, but I have a hard time understanding why it's the community's responsibility to document licensed code. This isn't open source. I paid a decent license fee, plus annual renewals, to purchase the right to use xenForo. (And I have to pay an additional fee if I want their copyright removed from my site...) The company is a commercial enterprise. They should hire someone to write documentation.

XF 2.x has been out since last year and there are still no docs for something as simple and integral as the template syntax. While I have the ability to read the code and work my way through it dumping variables and setting breakpoints, it doesn't mean I want to spend my time learning the code base in order to use the template tags effectively. I took over a site recently and upgraded from 1.5.21 to 2.0.7, and it probably took me 2 to 3 times longer than it should have precisely because I had to dive into the code to figure things out. While I agree that the code is the authoritative source, it is far from "the best documentation you can have." The best documentation is accessible, easy to read, and has several clear examples. The xenForo code base is clean and well-structured, but it is not a replacement for good documentation.

I don't want to be completely negative. The existing user manual is good and the developer docs are decent, for what they are -- there's just not enough. I don't know how other people feel, but honestly I don't have time to write docs for xenForo. When I pay for a license, I want to be productive with the software. I don't want to trace through the code in order to use it. And just to be clear, I'm an end-user. I'm not writing add-ons for other people to use. I'm using the dev tools to improve my own deployments.
 
The company is in no way obligated to provide documentation for their code in any way. We can consider ourselves thankful in the first place for having the opportunity to have such awesome mod support, that actually allows us to "plug&play" our modifications with a few button clicks. They've done great. There is enough software out there were you don't even get half of that, if you even get the source code, that is.

And in all honesty, it took me about five minutes to find out about all the template tags availble and their input arguments. As my teacher loved to say: There's two things to reading - the ability to read, and the ability to understand what you're reading. The first one is useless without the latter one. So take a step back, work yourself more into php, and things will come naturally. I can tell from first hand experience.

As someone who worked with XF and WP in the past I can only repeat myself: XFs code documents itself well enough for the most part. There're pieces here and there that do not, but you always get that. Working with WordPress is a pain in the butt compared to that, even with their extensive docs at hand. They should've dedicated a lot more documentation time to actual structural improvements imo.
 
1) I find it hard to believe that anyone who works for xenForo would say they are not obligated to provide documentation in any way. That's a fairly senseless statement for a software company to make. (and your attitude bugs me a bit, given #5 below...)

2) I don't consider myself thankful when a product I pay for works. That's silly. I'm satisfied when it works and happy when it exceeds my expectations. And I'm not afraid to point things out when it falls short. Constructive criticism can help improve a product. I appreciate it when my customers voice their opinions, good and bad. Feedback from end-users is essential.

3) You have NO idea my level of expertise with PHP or any other programming language, so please don't assume. For you to tell me to work myself more into PHP is, at best, foolish and at worst condescending. (I'll give you the benefit of the doubt) I've already submitted a bug report and fix to XF for something I found while crawling through the code -- granted, not a huge one, but I am more than capable of understanding what I read.

4) WordPress is open source and free to use. I expect less from it.

5) I'm also a customer of ThemeHouse (UI.X2 Dark) and have submitted tickets for bugs to your system. (no complaints about the response or the docs...)

6) As you're not a xenForo dev, this thread is way off-topic and pointless. Agree to disagree and leave it at that.
 
Back
Top Bottom