All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

Problem getting P&T var to parse

Andre Goldstein 20 Nov 2011 19:05 question, complete

Hi Low, I'm having problems getting a P&T var to parse. I've currently got a var called "show_facebook" with y and n.

In my code I'm using {if show_facebook == "y"} {/if}

But even though it's set to y, nothing shows. I've also tried a variety of ways using parse but to no avail.

Out of interest what is the correct way to display a P&T var?

Thanks

Replies

  1. Low 20 Nov 2011 19:07

    If you're using the var in a conditional, you'll need to enable early parsing for that var. Have you done so?

  2. Andre Goldstein 20 Nov 2011 19:10

    Hi Low, yes I had enabled them then tried without but have now put it back.

    What are the correct tags in this instance?

    {if show_facebook == "y"}

    {/if}

    ?

  3. Low 20 Nov 2011 19:13

    Yeah, that should work, just like a snippet, basically. I take it you're using PT Switch or something?

    You can check the value by turning on template debugging and looking at the snippets listed there.

  4. Andre Goldstein 20 Nov 2011 19:16

    Yes am using P&T switch.

    Sorry not too sure what you're meaning by snippet in this instance?
    And how would I go about turning on template debugging?

    I've basically got two icons with links to fb and twitter and want the client to be able to decide if they show up or not.

    Thanks

  5. Low 20 Nov 2011 19:24

    You can turn on template debugging under Admin -> System Administration -> Output and Debugging Preferences -> Display Template Debugging. Once turned on, there'll be a long list of debugging data at the bottom of your page. In that list, you'll find your site's snippets and early parsed Low Variables next to the labels "Snippets (Keys):" and "Snippets (Values):". There you can check if the values are correct.

    With snippets I mean the native snippets provided by EE2. They can be used in simple conditionals. And because early parsed Low Variables are essentially equal to snippets, they work in conditionals in the same way.

  6. Andre Goldstein 20 Nov 2011 19:30

    Thanks. However, I've turned on template debugging but on my page (you do mean website page?) I don't see anything.

    Do I have to view my page via the cp or something?

  7. Andre Goldstein 20 Nov 2011 19:30

    sorry they're coming up now

  8. Andre Goldstein 20 Nov 2011 19:39

    Thanks, I enabled debugging and noticed they were both set to y but then noticed the variable was wrapped within { tags. I removed them and all is working great.

    Strange as before I didn't have these tags and it still wasn't working! However, it's always the way with these things that we try and change so many parameters so quickly to get things to work that we can't remember what was wrong in the first place!

    Thanks for your prompt support Low

  9. Low 20 Nov 2011 19:41

    Cool, glad it's working now. :)