• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Running into a bit of an issue with template modifications

Jake B.

Well-known member
#1
I'm trying to make it so you can set a rel and target attribute on navigation li
nks using $extraTabs. It is working fine on the default theme with the following settings:

Find:
Code:
<a href="{$extraTab.href}" class="navLink">
Replace:
Code:
<a href="{$extraTab.href}" class="navLink" rel="{$extraTab.rel}" target="{$extraTab.target}">
However, on UI.X it obviously would not work due to the large amount of changes made in the navigation template, so to make things a bit easier I created a second template modification with the following:

Find:
Code:
<a href="{$extraTab.href}" class="navLink{xen:if '!@uix_alwaysShowNavDropdownArrow', ' NoPopupGadget'}"{xen:if '!@uix_alwaysShowNavDropdownArrow', ' rel="Menu"'}>
Replace:
Code:
<a href="{$extraTab.href}" class="navLink{xen:if '!@uix_alwaysShowNavDropdownArrow', ' NoPopupGadget'}"{xen:if '!@uix_alwaysShowNavDropdownArrow', ' rel="Menu {$extraTab.rel}"', ' rel="{$extraTab.rel}"'} target="{$extraTab.target}">
But it is not modifying the navigation template for UI.X.

Here is what it's showing me on the template modifications page:
template_modifications.PNG

This is for the default one:
modification_log_default.PNG

And the UI.X one:
modification_log_UI.X.PNG

I cannot figure out why the apply count is at zero.. I haven't done much using the template modifications, so it is probably just something stupid I have missed.
 

Steve F

Well-known member
#2
It is showing zero because you're searching for something that doesn't exist in the master style, in your second modification. Modifications are not style based so you can't search for a modified line from another style.

To further extend it, a regex replacement will be needed.
 
Last edited:

Jake B.

Well-known member
#3
It is showing zero because you're searching for something that doesn't exist in the master style, in your second modification. Modifications are not style based so you can't search for a modified line from another style.

To further extend it, a regex replacement will be needed.
I've tried a few different ways to do a regex replacement, but have not gotten it to work correctly.
 

Mike Creuzer

Well-known member
#4
Find class="navLink and replace that. Its proper anyways, I mean the way you do it there any theme that modifies links it won't work.
 
Last edited:

Jake B.

Well-known member
#6
Find class="navLink and replace that. Its proper anyways, I mean the way you do it there any theme that modifies links it won't work.
Then you run into the issue of having a link that has two rel attributes because of this:

Code:
{xen:if '!@uix_alwaysShowNavDropdownArrow', ' rel="Menu"'}
Do the find on the default template code.
That's what I did originally, however UI.X's navigation template was changed too much for it to find in both.

Also, if you add nofollow or noreferrer to the rel="Menu" it makes the dropdown stop working.
 
Last edited:

Mike Creuzer

Well-known member
#7
Then in that case, you'll want to check if there is a rel="*" and replace it with rel="{1} $whatever_here". I am trying to see how I can do what I want with UI.X (toggleable dropdown menus) and yet still work with plugins. Some clever regex is the only solution, so I think what we might do is convert that setting to a plugin in the future :/