Resource icon

Template Modification System (TMS) 1.3.1

No permission to download
Forget PHP Callback as that's very advanced.

The way TMS works, though, is Search and Replace.

So you're basically saying find THIS and replace it with THIS.

So a basic example from your vBulletin notices modification.

1) Select the "notice" template.
2) Search for:
Code:
<li class="panel Notice DismissParent notice_{$noticeId}">
3) Replace with:
Code:
<li class="vbnotices Notice DismissParent notice_{$noticeId}">

When you click Save and Check, you will get an overlay pop up which will show the original version of the template, compared to your new modification.

Now when the template renders it will be changed to:

Code:
<li class="vbnotices Notice DismissParent notice_{$noticeId}">
    <div class="{xen:if {$notice.wrap}, 'baseHtml noticeContent'}">{xen:raw $content}</div>
 
    <xen:if is="{$notice.dismissible}">
        <a href="{xen:link account/dismiss-notice, '', 'notice_id={$noticeId}'}"
            title="{xen:phrase dismiss_notice}" class="DismissCtrl Tooltip" data-offsetx="7" data-tipclass="flipped">{xen:phrase dismiss_notice}</a></xen:if>
</li>
 
The answer is to include it in the replacement. So in the example above, if you needed to add another div below the first <li class="vbnotices etc. then search for

Code:
<li class="vbnotices Notice DismissParent notice_{$noticeId}">

and replace it with the same code plus whatever you want to add:

Code:
<li class="vbnotices Notice DismissParent notice_{$noticeId}">
<div class="someclass">Some content</div>

Should result in:

Rich (BB code):
<li class="vbnotices Notice DismissParent notice_{$noticeId}">
<div class="someclass">Some content</div>
    <div class="{xen:if {$notice.wrap}, 'baseHtml noticeContent'}">{xen:raw $content}</div>
 
    <xen:if is="{$notice.dismissible}">
        <a href="{xen:link account/dismiss-notice, '', 'notice_id={$noticeId}'}"
            title="{xen:phrase dismiss_notice}" class="DismissCtrl Tooltip" data-offsetx="7" data-tipclass="flipped">{xen:phrase dismiss_notice}</a></xen:if>
</li>
 
You can't, it's for HTML templates only.

Try this:

1) Create a new template in the Master Style called whateveryoulike.css and select your add-on from the drop down.
2) Add your content to it.
3) In your template, add the following:
Code:
<xen:require css="whateveryoulike.css" />

Now when you Export your add on it will include that new css file.
 
If it's for a style you're making, EXTRA.css will be blank anyway so you can just add whatever you need to it.
He knows that - he's trying to create an add on though so he can't use extra.css for that. Unless people who want the add on want to do it themselves which isn't ideal.
 
Thanks for helping people Yorick! From your posts FAQ can be done :)

I would add that adding content is possible with preg replace:
Search:
Code:
#^.*$#s
Replace:
Code:
$0
/*your added code*/
 
Thanks guiltar

I'd love to learn more how that works... :( Is there any guides specific to the TMS?
 
It's surprisingly simple!

All you need to do is:

3) When you create your Template Modification, ensure "Master Style" is selected and from the drop down list labelled Add-On select your newly created Add-On.

select-addon.webp

I don't have a drop down to select my addon.

What to do ?

Thanks.
 
You need to create the Modification using the Master Style.

On the Template Modifications main screen, click the drop down I've highlighted below and select "Master Style".

Then, when you create your modification you can select your add on :)

masterstyle.webp
 
You need to keep Debug mode enabled.
Ok, now its there.

I want to add a header to my site, so I created the addon, I select my addon from the list in templates I search for header and select it.

That shows "Original Template Text:" showing what the header has.

I have to put the same "Original Template Text:" in the search and my modified code in the replace ?

After finishing I can disable debug, right ?

Thanks.
 
Are you planning to release the Template Modification on the Resource Manager for other people to use?
 
Well, I don't understand, please explain me.

I just want to add to my header 10 lines of code with my navigation menu. Instead of going to the header file and paste my code, I was trying this, so in future updates I don't have to go to header and paste my code.

So, what I am going to release with this ? I just want my navigation in XF header, thats it.

Maybe I did not get something about this addon, so please help me understand if its not for what I am doing.

Thanks.
 
This add-on will do what you want.

But my instructions were geared specifically around people wanting to release the modifications they've made as add-ons to other people. If you're making this for your own site, you don't need to follow all of my instructions.

To clarify: You do not need to turn on debug mode (you can turn it off now) and you do not need to work in the Master Style.

Here's what to do:

1) Go to Admin CP > Apperance > Template Modifications
2) Select the Style you want to modify from the list
3) Click Create New Template Modification

To answer your question:

Yes you could put the original code in the search and whatever you want to replace it with in the replace field.

You don't always have to put all of the original code in the search field. It's always best to pick out the little parts that have changed and replace them that way. But I'm sure you will find a way that works best for you.
 
Back
Top Bottom