XF 2.2 Addon template modification

Anatoliy

Well-known member
So I'm building my first addon that will deal with too long thread titles. So far it can find threads with title length longer than 70 characters and list them.
What I want to do next is to bulk fix them by removing " | Board title" from their titles. So I created a PAGE_CONTAINER template modification that will replace
Code:
<title><xf:title formatter="%s | %s" fallback="{$xf.options.boardTitle}" page="{$pageNumber}" /></title>
with
Code:
<title>
<xf:if is="$noBoardTitle">
<xf:title formatter="%s" fallback="{$xf.options.boardTitle}" page="{$pageNumber}" />
<xf:else />
<xf:title formatter="%s | %s" fallback="{$xf.options.boardTitle}" page="{$pageNumber}" />
</xf:if>
</title>

The question - what would be the best field for storing the "mark" that thread title is too long?
Probably an extra column in xf_threads table, but frankly I'm too afraid to touch xf tables. )
What about a thread custom field? I could create it from ACP so it looks safe. Or it will require an extra query when rendering a thread page?

Will be appreciate for any advice.
Thanks in advance.
 
oops... just noticed that forum list and category shows an error

Template errors​

  • Template public:PAGE_CONTAINER: [E_DEPRECATED] utf8_decode(): Passing null to parameter #1 ($string) of type string is deprecated (src\vendor\dokuwiki\utf8\utf8.php:141)
Here's what I have in template modification

Code:
<title>
<xf:if is="{{strlen($pageTitle) > 50}}">
<xf:title formatter="%s" fallback="{$xf.options.boardTitle}" page="{$pageNumber}" />
<xf:else />
<xf:title formatter="%s | %s" fallback="{$xf.options.boardTitle}" page="{$pageNumber}" />
</xf:if>
</title>
 
So if I already used
Code:
php cmd.php xf-addon:build-release AV/Titles
to build my addon, and now I made changes to it, what command do I use to build(release?) the next version?

I used the same command expecting it will create next version, but it created again AV-Titles-1.0.0 Alpha zip, that overrided the previous one.
 
Versioning is based on whether it's a first, second, or third point release.
that is Chinese for me )))

Version ID set to: 1000011
Version string set to: 1.0.0 Alpha 1
The addon.json file was successfully written out to C:\xampp\htdocs\xf\src\addons\AV\Titles\addon.json
Add-on successfully updated to version 1.0.0 Alpha 1 (1000011).

But I still see AV-Titles-1.0.0 Alpha zip in _releases. It means now I have to run
Code:
php cmd.php xf-addon:build-release
?
 
If your release is 1.0.0 Alpha 1 then the version string should be 1000011.

If the next release is 1.0.0 Alpha 2 then it would be 1000012.
I got that. I thought it would put archives into _releases so all of them would be acceptable if "oops" happens and I need to quickly revert back to the previous version.

So now after
Code:
php cmd.php xf-addon:bump-version
it shows "Thread Title Length 1.0.0 Alpha 1" under installed addons on my local dev server. I'd like to upgrade from Alpha to Alpa 1 on my production xF, but I'm kind of scared because zip still has name Alpha and not Alpha 1 as I would expect.
 
Back
Top Bottom