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.

Query module and php in snippet

June 20, 2012 3:09pm

Subscribe [2]
  • #1 / Jun 20, 2012 3:09pm

    funnEE

    94 posts

    I am not able to make get the following code to work in a snippet.  I set the template to allow php and parse on input.  I am not able to get the userdata call to work in the template either.

    {exp:query sql="SELECT DISTINCT name
    FROM purchases
    WHERE name = '<?php echo $this->EE->session->userdata['username']; ?>' "}
    <a href="#" class="menu_link">{name}</a>
    {/exp:query}

    I think my issues are with the parsing order.  Does php inside a snippet get parsed before a module tag?
    Thanks in advance for helping 😊

    Edit:  I am using MSM, could this be causing the problem?

  • #2 / Jun 20, 2012 7:21pm

    Stephen Callender

    148 posts

    Yes, I’m pretty sure php inside a snippet is parsed before a module tag.
    What’s not working? Is {name} not printing or is the whole thing not printing?

  • #3 / Jun 20, 2012 7:33pm

    funnEE

    94 posts

    Hi Stephen,
    I now found out that I can not get any standard variables to work in my new site in MSM.  I think that I have missed some setting that is not allowing standard variables to work.  Example, when I use in the template {username}, it displays {username} on the webpage. 
    Thanks for answering,
    Dave

  • #4 / Jun 20, 2012 11:41pm

    Stephen Callender

    148 posts

    I haven’t done much MSM, so I’ll have to leave you to the EE folks. Sorry I couldn’t help more. Best of luck.

  • #5 / Jun 21, 2012 8:54am

    funnEE

    94 posts

    Thanks Stephen
    THis thread can be closed as I have started a different thread.

  • #6 / Jun 21, 2012 11:29am

    Shane Eckert

    7174 posts

    Hey funnEE,

    Closing off. Thanks Stephen for your help!

    If you need anything else, please just let me know by opening a new thread.

    Cheers,

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

ExpressionEngine News!

#eecms, #events, #releases