Can I find and replace multiple lines in Template Modifications?

Joe Link

Well-known member
I'm sure this is possible, but after two hours of trying to figure it out, I'm asking :confused:

I'd like my modification to replace the first piece of code with the second, in the navigation tab.

Code:
                <a href="{$extraTab.href}" class="navLink">{$extraTab.title}<xen:if is="{$extraTab.counter}"><strong class="itemCount"><span class="Total">{$extraTab.counter}</span><span class="arrow"></span></strong></xen:if></a>
                <a href="{$extraTab.href}" class="SplitCtrl" rel="Menu"></a>

Code:
                <a href="{$extraTab.href}" class="navLink NoPopupGadget" rel="Menu">{$extraTab.title}<xen:if is="{$extraTab.counter}"><strong class="itemCount"><span class="Total">{$extraTab.counter}</span><span class="arrow"></span></strong></xen:if></a>
                <xen:comment><a href="{$extraTab.href}" class="SplitCtrl" rel="Menu"></a></xen:comment>

For whatever reason, I can't find a way to tell it to 'find' both lines of code. If I enter a single line, it works fine.

Thanks guys.
 
When the text to replace is not continuous, you will need to create two Template Modifications.
 
Last edited:
You can do it with regex, you would need to make the template content that is matched between the two pieces (which you need to replace) it's own capture group and then reference it in the replace string in between your two new replacement string parts.
 
You can do it with regex, you would need to make the template content that is matched between the two pieces (which you need to replace) it's own capture group and then reference it in the replace string in between your two new replacement string parts.

Is that a path a beginner such as myself should wander down at this point, or should I stick to learning the basics for now? :D
 
Is that a path a beginner such as myself should wander down at this point, or should I stick to learning the basics for now? :D
That is up to you, I learned regex without knowing what it was a few years ago. The good thing about template mods vs using regex to make changes in your db is that you can easy change or delete a template mod with no loss of data so if you are going to try there is never a better time <shrug>. S'all up to you really.
 
Back
Top Bottom