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

XF 1.3 Copying template code

Discussion in 'XenForo Questions and Support' started by Neil E., Jul 27, 2014.

  1. Neil E.

    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?
     
  2. EQnoble

    EQnoble Well-Known Member

    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 :))
     
  3. Neil E.

    Neil E. Active Member

    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).
     
  4. Brogan

    Brogan XenForo Moderator Staff Member

    Which browser are you using?

    I seem to recall this happening a few releases ago but only with one browser (possibly Firefox).
     
  5. EQnoble

    EQnoble Well-Known Member

    Where are you copying the block of code from?
     
  6. Neil E.

    Neil E. Active Member

    Copy of the visible "Template Contents" window pasted into the "Find" window.

    copy-paste.jpg
     
  7. Neil E.

    Neil E. Active Member

    I am using Firefox, but it's the same version I've used on all previous XF editing.
     
  8. Brogan

    Brogan XenForo Moderator Staff Member

    I doubt it is the same version, unless you have automatic updating disabled.

    A new update was rolled out 22 July - 31.0.
     
  9. Neil E.

    Neil E. Active Member

    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.
     
  10. EQnoble

    EQnoble Well-Known Member


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

    you are copying here...
    gfdfgdfgdf.png

    try copying that same text from here
    fgdgdfg.png
     
    Neil E. likes this.
  11. Neil E.

    Neil E. Active Member

    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?
     
  12. EQnoble

    EQnoble Well-Known Member

    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.
     
  13. Neil E.

    Neil E. Active Member

    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.
     

Share This Page