XF 1.3 Copying template code

Neil E.

Active member
When I copy some template code into a search/replace template modification window (or Notepad++), it comes in as a lump with no line spacing or formatting. Never had any problem doing this in the past.

Here is a sample from the footer template:
<xen:if is="{$canChangeStyle} OR {$canChangeLanguage}"> <dl class="choosers"> <xen:if is="{$canChangeStyle}"> <dt>{xen:phrase style}</dt> <dd><a href="{xen:link 'misc/style', '', 'redirect={$requestPaths.requestUri}'}" class="OverlayTrigger Tooltip" title="{xen:phrase style_chooser}" rel="nofollow">{$visitorStyle.title}</a></dd> </xen:if> <xen:if is="{$canChangeLanguage}"> <dt>{xen:phrase language}</dt> <dd><a href="{xen:link 'misc/language', '', 'redirect={$requestPaths.requestUri}'}" class="OverlayTrigger Tooltip" title="{xen:phrase language_chooser}" rel="nofollow">{$visitorLanguage.title}</a></dd> </xen:if> </dl> </xen:if>

What am I doing wrong?
 
When I copy some template code into a search/replace template modification window (or Notepad++), it comes in as a lump with no line spacing or formatting. Never had any problem doing this in the past.

Here is a sample from the footer template:
<xen:if is="{$canChangeStyle} OR {$canChangeLanguage}"> <dl class="choosers"> <xen:if is="{$canChangeStyle}"> <dt>{xen:phrase style}</dt> <dd><a href="{xen:link 'misc/style', '', 'redirect={$requestPaths.requestUri}'}" class="OverlayTrigger Tooltip" title="{xen:phrase style_chooser}" rel="nofollow">{$visitorStyle.title}</a></dd> </xen:if> <xen:if is="{$canChangeLanguage}"> <dt>{xen:phrase language}</dt> <dd><a href="{xen:link 'misc/language', '', 'redirect={$requestPaths.requestUri}'}" class="OverlayTrigger Tooltip" title="{xen:phrase language_chooser}" rel="nofollow">{$visitorLanguage.title}</a></dd> </xen:if> </dl> </xen:if>

What am I doing wrong?
I have to assume you are copy and pasting the template contents from the modification page, open another tab and using the template editor open that same template you are trying to aplly a mod to then copy the same swath of code from there.



PS. (you should paste code in [code][/code] tags so it preserves formatting :))
 
I understand the insert code function, but without the format it came in as a single non-wrapped line (which doesn't look like the lump I am describing).

Code:
<xen:if is="{$canChangeStyle} OR {$canChangeLanguage}"> <dl class="choosers"> <xen:if is="{$canChangeStyle}"> <dt>{xenhrase style}</dt> <dd><a href="{xen:link 'misc/style', '', 'redirect={$requestPaths.requestUri}'}" class="OverlayTrigger Tooltip" title="{xenhrase style_chooser}" rel="nofollow">{$visitorStyle.title}</a></dd> </xen:if> <xen:if is="{$canChangeLanguage}"> <dt>{xenhrase language}</dt> <dd><a href="{xen:link 'misc/language', '', 'redirect={$requestPaths.requestUri}'}" class="OverlayTrigger Tooltip" title="{xenhrase language_chooser}" rel="nofollow">{$visitorLanguage.title}</a></dd> </xen:if> </dl> </xen:if>

I tried your method of having two browser windows open and copy/paste from one window to the other but it just had the same result (no format).
 
I understand the insert code function, but without the format it came in as a single non-wrapped line (which doesn't look like the lump I am describing).

Code:
<xen:if is="{$canChangeStyle} OR {$canChangeLanguage}"> <dl class="choosers"> <xen:if is="{$canChangeStyle}"> <dt>{xenhrase style}</dt> <dd><a href="{xen:link 'misc/style', '', 'redirect={$requestPaths.requestUri}'}" class="OverlayTrigger Tooltip" title="{xenhrase style_chooser}" rel="nofollow">{$visitorStyle.title}</a></dd> </xen:if> <xen:if is="{$canChangeLanguage}"> <dt>{xenhrase language}</dt> <dd><a href="{xen:link 'misc/language', '', 'redirect={$requestPaths.requestUri}'}" class="OverlayTrigger Tooltip" title="{xenhrase language_chooser}" rel="nofollow">{$visitorLanguage.title}</a></dd> </xen:if> </dl> </xen:if>

I tried your method of having two browser windows open and copy/paste from one window to the other but it just had the same result (no format).

Where are you copying the block of code from?
 
I do automation programming which involves a lot of serial port or USB downloading to controllers. As a result I never have anything set for auto update. The idea is to reduce the possibility of anthing interrupting a critical download. I generally run old versions of most software just to avoid any "new feature" problems.
 
I have to assume you are copy and pasting the template contents from the modification page, open another tab and using the template editor open that same template you are trying to aplly a mod to then copy the same swath of code from there.



PS. (you should paste code in [code][/code] tags so it preserves formatting :))
Copy of the visible "Template Contents" window pasted into the "Find" window.

View attachment 78937


Like I said try copying from the actual template editor, and NOT within the template mods system

you are copying here...
gfdfgdfgdf.webp

try copying that same text from here
fgdgdfg.webp
 
Thank you for stressing this point. I could not see how these areas would act differently, but they do.
It works correctly when the template editor is the source. Any idea why this is?

Has anyone else seen this behaviour?
 
Thank you for stressing this point. I could not see how these areas would act differently, but they do.
It works correctly when the template editor is the source. Any idea why this is?

Has anyone else seen this behaviour?
I have indeed but I look at it this way...most people don't have the template structure memorized to the point where they can just go to the template mod creation page and just whip up changes they need. Most will go through the templates and work out the changes they need, and then if applicable rewrite them to a template mod making the template content displayed on the TM page really just a visual reference and to be honest the most powerful part of the TM system is the ability to use regex and when doing so you almost never copy and paste a block of code as an expression which is why I personally never brought it up as some sort of unexpected behavior because the way I use it for the most part exactly fits the way it operates.

I haven't looked into it myself but I am sure it could be changed to work the same in that template preview element of the TM system. If nothing comes of it I will look at it when I finish the job I am on and see if it is something reasonably easy to and worth changing as an end user.
 
Interesting viewpoint. In the past, I found it very handy to use the TMS page template code when I was making code changes. If it was a large code change then I pasted it into Notepad++ and did my work there. This was in previous versions of XF (before TMC).

I always used TMS and found it extremely handy. I guess when TMC came about, the template content window was intended to be only used as a viewer.

I've been struggling with the whole direct template editing situation and have changed directions again. I have installed Guiltar's 1.3.1 TMS and Chris D's "enable debug from the admin panel". This lets me create template mods based on a style, which is a real benefit. I want this so that if another admin has to take over, there would be a way to keep my work separated from the master templates. This would also allow for the new guy to keep his own style work organized well.
 
Back
Top Bottom