Resource icon

Template Modification System (TMS) 1.3.1

No permission to download
I'm having an issue with trying to use the php callback. It's not saving my specified class and function.

I'll enter MyMod_Listener_Template :: templateTms The file and function both exist:
In file: library/MyMod/Listener/Template.php
PHP:
class MyMod_Listener_Template
{
public static function templateTms( &$template, &$applyCount, $styleId )
    {
        $template .= 'stuff';
        return $template;
    }
}
1. Is there a reason why it wouldn't save the class:function name?
2. Are the parms for the function correct?
3. Should it be returning the template var? and if not, what should it return?
 
I just realized I'm not going to need that php callback this time, but the question still stands for future development. :)
 
I think I'm just going to start pulling from your github account, that's so much easier than downloading, transferring, unzipping from here.
 
It's a little bit a big suggestion but have you ever thought of people just edit templates and TMS can automatically create modifications?
 
Hi. One mistake found during translation. The button "Rebuild Templates" (admin.php?styles/default-style.1/template-modifications) don't use the translated phrase ;)
 
If I wanted to for example wrap the whole footer template with

<div class="footerWrap>
orginal footer template code
</div>

Can I do that with one template edit or would I have to create two, one to add <div class="footerWrap> at the top and another to add </div> at the bottom?

thanks
 
You can use Preg Replace with
search:
Code:
#^.*$#s
replace:
Code:
<div class="footerWrap>
$0
</div>
 
You can use Preg Replace with
search:
Code:
#^.*$#s
replace:
Code:
<div class="footerWrap>
$0
</div>

Thanks, I made a mistake in my previous post , I meant what if I wanted to change the top and bottom of the footer template

This at the top:

<xen:hook name="footer">
-- add this new line - <div class="footerwrap">
<div class="footer">

And this at the bottom :
</div>
-- add this new line -- </div>
</xen:hook>

Thanks
 
The above preg replace wraps the whole footer with hook.
You may wrap inside the hook, but there will be a design issues in this case if some addon will use this hook.
I mean, if some addon adds something to the end of the hook and you wrapped the footer insede the hook, than the rendered version will be equal to:
Code:
<xen:hook name="footer">
-- add this new line - <div class="footerwrap">
<div class="footer">
 
And this at the bottom :
</div>
-- add this new line -- </div>
[ADDED BY SOME ADDON]
</xen:hook>
The [ADDED BY SOME ADDON] will just break your design.
 

Attachments

  • Screenshot_27.webp
    Screenshot_27.webp
    20.2 KB · Views: 16
The above preg replace wraps the whole footer with hook.
You may wrap inside the hook, but there will be a design issues in this case if some addon will use this hook.
I mean, if some addon adds something to the end of the hook and you wrapped the footer insede the hook, than the rendered version will be equal to:
Code:
<xen:hook name="footer">
-- add this new line - <div class="footerwrap">
<div class="footer">
 
And this at the bottom :
</div>
-- add this new line -- </div>
[ADDED BY SOME ADDON]
</xen:hook>
The [ADDED BY SOME ADDON] will just break your design.

Of course, i didnt think of that, thanks
 
Great plugin :)

Have you any thoughts on developing an import and export system. This would allow us to transfer modifications between themes.

I also noticed that if you reupload your xml file, all the modifications is lost. I found this a little frustrating as I removed several modifications from my template and made some changes but when I went back to the previous version the mods were lost.

This is perhaps due to the way I work. I sometimes tweak my design but before doing so I back up my style so that I can revert to it if I don't like the changes. :)
 
Thanks!

Modifications are imported/exported with addons and styles just like templates.
If you want to transfer mod, you can create empty addon for it and export this addon.

I also noticed that if you reupload your xml file, all the modifications is lost. I found this a little frustrating as I removed several modifications from my template and made some changes but when I went back to the previous version the mods were lost.

This is perhaps due to the way I work. I sometimes tweak my design but before doing so I back up my style so that I can revert to it if I don't like the changes. :)
I guess you upgraded your style by old version without mods thats why they were deleted. Templates would also lost in this case.
In import/export mods are similar to templates.
 
Hi!

At first thanks for this really great addon! I used this addon now for all my template modifications. Bute now I got a problem. I tried to do two template modifications in the message_user_info template. The first one looks like this:

Search for:
HTML:
<div class="messageUserBlock">

Replace with:
HTML:
<xen:if is="{xen:helper ismemberof, $user, 3}"> <div class="messageUserBlock admin">
<xen:elseif is="{xen:helper ismemberof, $user, 4}" /> <div class="messageUserBlock moderator">
<xen:elseif is="{xen:helper ismemberof, $user, 2, 5, 6}" /> <div class="messageUserBlock mitglied">
<xen:else /> <div class="messageUserBlock gast">
</xen:if>

Which works fine.

then a create a second Template Modifications for this template with the following content:

Search for:
HTML:
<h3 class="userText">
            <xen:username user="$user" itemprop="name" rich="true" />
            <xen:if hascontent="true"><em class="userTitle" itemprop="title"><xen:contentcheck>{xen:helper userTitle, $user}</xen:contentcheck></em></xen:if>
            <!-- slot: message_user_info_text -->
        </h3>

Replace with:
HTML:
<xen:if is="{xen:helper ismemberof, $user, 3}">
                <h3 class="userText admin">
            <xen:username user="$user" itemprop="name" rich="true" />
            <xen:if hascontent="true"><em class="userTitle" itemprop="title"><xen:contentcheck>{xen:helper userTitle, $user}</xen:contentcheck></em></xen:if>
            <!-- slot: message_user_info_text -->
        </h3>
 
                <xen:elseif is="{xen:helper ismemberof, $user, 4}" />
                <h3 class="userText moderator">
            <xen:username user="$user" itemprop="name" rich="true" />
            <xen:if hascontent="true"><em class="userTitle" itemprop="title"><xen:contentcheck>{xen:helper userTitle, $user}</xen:contentcheck></em></xen:if>
            <!-- slot: message_user_info_text -->
        </h3>
 
                <xen:elseif is="{xen:helper ismemberof, $user, 2, 5, 6}" />
                <h3 class="userText mitglied">
            <xen:username user="$user" itemprop="name" rich="true" />
            <xen:if hascontent="true"><em class="userTitle" itemprop="title"><xen:contentcheck>{xen:helper userTitle, $user}</xen:contentcheck></em></xen:if>
            <!-- slot: message_user_info_text -->
        </h3>
 
                <xen:else />

This one works not for me. The addon says no differnces found. When I try instead of theis huge code block this one:

HTML:
<h3 class="userText">
 
<!--This is a Test -->
 
 
            <xen:username user="$user" itemprop="name" rich="true" />
            <xen:if hascontent="true"><em class="userTitle" itemprop="title"><xen:contentcheck>{xen:helper userTitle, $user}</xen:contentcheck></em></xen:if>
            <!-- slot: message_user_info_text -->
        </h3>

everything works fine. So I think the problem is somewhere in the huge codeblock above. But I hvae no idea where the problem is.

Maybe someone has an idea?

Thanks for your help!

Benny
 
Back
Top Bottom