ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

help with show/hide code

June 29, 2007 7:25am

Subscribe [1]
  • #1 / Jun 29, 2007 7:25am

    Riverboy

    2993 posts

    If i create a global variable called “test” - how can i call it in templates?

    Is it simply {test} and EE will “sniff” it to template?

    Thanks!
    - Tuittu

  • #2 / Jun 29, 2007 7:50am

    Wolfram

    115 posts

    Hi Tuittu, just put {test} where you want it in the template, and the content will be displayed. Wolfram

  • #3 / Jun 29, 2007 7:59am

    Riverboy

    2993 posts

    Yeah i kinda knew that but this pretty cool system doesnt still work:

    http://haroblogger.com/index.php/hb/single/more_and_less_tutorial_for_expressionengine/

    Cheers:
    - Tuittu

  • #4 / Jun 29, 2007 11:19am

    Lisa Wess

    20502 posts

    That tutorial should work.  If you’ re having problems with it and want help, you’ll need to post a lot more details.

  • #5 / Jun 29, 2007 1:52pm

    Riverboy

    2993 posts

    
    
    

    That is the testcode!
    And i made global variable called “luekaikki” and added into same template as where above code is the tag

    {luekaikki}

    inside the body-tag!

    I did copy first the java-code and replaced the smartquotes from it also as i did to code above!

    Any help to solve the problem?
    Thanks!
    -Tuittu

  • #6 / Jun 29, 2007 1:54pm

    Lisa Wess

    20502 posts

    Do you have a link to where this is?  Do you have the header code that’s needed as per the tutorial?

  • #7 / Jun 29, 2007 1:59pm

    Riverboy

    2993 posts

    i PM you the link cos i dont want anyone to see unreleased site 😊 If you mean the java-code as header code - i copied that and made global variable from that. I saw 2 code “packs” where this is originally located this good tutorial. other went to template and the other is the global variable!

    - Tuittu

  • #8 / Jun 29, 2007 2:05pm

    Lisa Wess

    20502 posts

    First, your javascript code (your global variables) needs to be in the head, before </head> -not in the body.  Try that =)

    Also I’m going to move this to how-to as that’s the appropriate place for this, as it’s a bit beyond the technical support forum. =)

  • #9 / Jun 29, 2007 2:15pm

    Riverboy

    2993 posts

    No problem at all for moving. You know better the right places if i get confused sometimes. Well i did move the {luekaikki} tag into head but no work still. Below is the java what i have inside the global:

    function showHide(entryID, entryLink, htmlObj, type) {

    if (type == "comments") {

    extTextDivID = (’comText’ + (entryID));

    extLinkDivID = (’comLink’ + (entryID));

    } else {

    extTextDivID = (’extText’ + (entryID));

    extLinkDivID = (’extLink’ + (entryID));

    }

    if( document.getElementById ) {

    if( document.getElementById(extTextDivID).style.display ) {

    if( entryLink != 0 ) {

    document.getElementById(extTextDivID).style.display = "block";

    document.getElementById(extLinkDivID).style.display = "none";

    htmlObj.blur();

    } else {

    document.getElementById(extTextDivID).style.display = "none";

    document.getElementById(extLinkDivID).style.display = "block";

    }

    } else {

    location.href = entryLink;

    return true;

    }

    } else {

    location.href = entryLink;

    return true;

    }

    }

    </script>

    - Your humble Tuittu

    EDIT: i tried to put the java inside of a code blocks but some of the codes went into bit heaven so here it is quoted!

  • #10 / Jun 29, 2007 2:16pm

    Lisa Wess

    20502 posts

    At this point I would recommend setting up a simple test template with only the bare minimum to test this, no global variables, all code there.  Get it working and then move the code to the proper places. I think you’re taking too many steps at once here. =)

  • #11 / Jun 29, 2007 2:20pm

    Riverboy

    2993 posts

    At this point I would recommend setting up a simple test template with only the bare minimum to test this, no global variables, all code there.  Get it working and then move the code to the proper places. I think you’re taking too many steps at once here. =)

    Well - i want to learn all and do all. After that i might be good help here when you all are sleeping and i can answer to questions like mine now 😊

    I try to put that java into template straight and see what happends 😊

    Thanks so much again, we’ll see what mess i get now at my future site, heh!
    - Tuittu

  • #12 / Jun 29, 2007 2:22pm

    Lisa Wess

    20502 posts

    I know you want to learn, and I think that’s wonderful.  But if *I* were having this problem on my site, I would get it working in a minimal template with the least amount of variables to troubleshoot. Then when it worked, I would get it working in my main template.  One step at a time.  I have these problems all the time, and that really is the best way to do these things. =)  I’m not trying to be difficult, I promise - this is what I do on my personal site. =)

  • #13 / Jun 29, 2007 2:25pm

    Riverboy

    2993 posts

    Well it didnt work :( i simply copied the java into <head> and tested. I must be missing something now or is there something that i must change in that code beside all the smart quotes?

    Unlucky, shamed (and little tired)- Tuittu

  • #14 / Jun 29, 2007 2:29pm

    Lisa Wess

    20502 posts

    Here is what I would recommend that you do.  Create a minimal template, no EE code in it. Something like:

    
    
    

    Replace instances of entry_id with a number, say 1.  Get that working the way you expect - once it does, then you can move the code over to your EE templates until you have it working there. Then you can move it into global variables and make sure it works that way. Then done. =)

    I’d also recommend modifying the title to “help with show/hide code” or some such - someone else may spot what the problem is in your template.

  • #15 / Jun 29, 2007 3:30pm

    Riverboy

    2993 posts

    EDIT: stupid me…. never mind. it was [removed] what were “removed”.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases