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

XF 1.5 Insert Cheap Trashy Myspace Era html code inside Specific forum only and not all <Head>

Discussion in 'Styling and Customization Questions' started by Recepcionist, Mar 2, 2016.

  1. Recepcionist

    Recepcionist New Member

    Hello XenForo!

    I'm getting there slowly, I think I made my way to 95% of what-i-needed, and now I encounter a problem I do not know how to resolve:

    Remember those stupid html effects like things falling from the sky? I got one of those "Geocitys codes" and would like to apply them only on an specific forum. Its like <script = pure cheap html. They ask you to put it into "head". But how can I find "head" for only 1 specific forum/subforum so it's not affecting all the forum/pages?


    Thank you for any help :)
     
  2. Chris D

    Chris D XenForo Developer Staff Member

    Assuming you only want the effect while viewing the forum, rather than viewing threads in those forums...

    Edit the "forum_view" template and add something like this, anywhere in that template:
    HTML:
    <xen:if is="{$forum.node_id} == 123">
        <xen:container var="$head.cheapHtml">
            <script>alert('Hello!');</script>
        </xen:container>
    </xen:if>
    You'll obviously need to make some adjustments there. Replace 123 with whatever the ID is of the forum you want this to happen in. Replace "cheapHtml" with anything you like (though choose something relatively unique to avoid this being overridden by something else or overriding something else). Replace the <script> bit with whatever HTML code you need.

    The end result is, the contents of the <xen:container> tag shoud appear within the <head> tag of the pages only within the forum specified.
     
  3. Recepcionist

    Recepcionist New Member


    Thanks Chris, I tried what you say but I got all my header removed (yes, I did something wrong obviously :-S)

    I think Im not inserting right the stuff. This is "the script" and this is What I wrote:



    HTML:
    <script type="text/javascript" src="http://www.snazzyspace.com/moveobj.js"> </script>
    <script type="text/javascript">
    
    /***********************************************
    * Floating image script- By Virtual_Max (http://www.geocities.com/siliconvalley/lakes/8620)
    * Modified by Dynamic Drive for various improvements
    * Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
    ***********************************************/
    
    //Step 1: Define unique variable names depending on number of flying images (ie:3):
    var flyimage1, flyimage2, flyimage3
    
    function pagestart(){
    //Step 2: Using the same variable names as 1), add or delete more of the below lines (60=width, height=80 of image):
    flyimage1=new Chip("flyimage1",85,104);
    flyimage2=new Chip("flyimage2",85,104);
    flyimage3=new Chip("flyimage3",85,104);
    
    
    //Step 3: Using the same variable names as 1), add or delete more of the below lines:
    movechip("flyimage1");
    movechip("flyimage2");
    movechip("flyimage3");
    
    }
    
    if (window.addEventListener)
    window.addEventListener("load", pagestart, false)
    else if (window.attachEvent)
    window.attachEvent("onload", pagestart)
    else if (document.getElementById)
    window.onload=pagestart
    
    </script>
    
    
    <!— Step 4: Define your flying images. For each image's ID tag, use the same variable names as 1) above —>
    
    <DIV ID="flyimage1" STYLE="position:absolute; left: -500px; width:85; height:104;">
    <A HREF="http://www.snazzyspace.com/moving-objects.php"><IMG SRC="http://www.snazzyspace.com/movingobjects/blood-brain.png" BORDER=0></a>
    </DIV>
    
    <DIV ID="flyimage2" STYLE="position:absolute; left: -500px; width:85; height:104;">
    <A HREF="http://www.snazzyspace.com/moving-objects.php"><IMG SRC="http://www.snazzyspace.com/movingobjects/blood-brain.png" BORDER=0></a>
    </DIV>
    
    <DIV ID="flyimage3" STYLE="position:absolute; left: -500px; width:85; height:104;">
    <A HREF="http://www.snazzyspace.com/moving-objects.php"><IMG SRC="http://www.snazzyspace.com/movingobjects/blood-brain.png" BORDER=0></a>
    </DIV>


    I went to the end of my forum_list (in order not to **** anything up) and added this which is super wrong im guessing now

    HTML:
    
    <xen:if is="{$forum.node_id} == 14">
        <xen:container var="$head.cheapHtml">
            <script>
    <A HREF="http://www.snazzyspace.com/moving-objects.php"><IMG SRC="http://www.snazzyspace.com/movingobjects/blood-brain.png" BORDER=0></a>
    </DIV>
    
    <DIV ID="flyimage2" STYLE="position:absolute; left: -500px; width:85; height:104;">
    <A HREF="http://www.snazzyspace.com/moving-objects.php"><IMG SRC="http://www.snazzyspace.com/movingobjects/blood-brain.png" BORDER=0></a>
    </DIV>
    
    <DIV ID="flyimage3" STYLE="position:absolute; left: -500px; width:85; height:104;">
    <A HREF="http://www.snazzyspace.com/moving-objects.php"><IMG SRC="http://www.snazzyspace.com/movingobjects/blood-brain.png" BORDER=0></a>
    </DIV>
    
    <script type="text/javascript" src="http://www.snazzyspace.com/moveobj.js"> </script>
    <script type="text/javascript">
    
    </script></xen:if>
        </xen:container>
     
    Last edited by a moderator: Mar 2, 2016
  4. Chris D

    Chris D XenForo Developer Staff Member

    forum_list template?

    Are you wanting to do something on the forum list or when you're viewing an actual forum?
     
    Recepcionist likes this.
  5. Recepcionist

    Recepcionist New Member

    thank you chris ! it worked u rock ! (and yes i got the wrong template the first time)
     
    Chris D likes this.

Share This Page