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.

Parsing tag stored in database after custom query

May 28, 2011 5:06pm

Subscribe [3]
  • #1 / May 28, 2011 5:06pm

    astronomad

    2 posts

    Hi All,

    I’m new to expression engine, and am picking it up fairly quickly. Hit a snag today though.

    I’ve created a template that will show the logged in member their purchases (made through simple commerce) with a link to download the purchased file, and created a custom query to pull the necessary information from the database.  The custom field field_id_9 from the channel entry contains the path and filename of the file to be downloaded. 

    Everything works great, except that field_id_9 contains the following information:

    https://ellislab.com/asset/images/pronet-logo/test_file.zip
    and the
    https://ellislab.com/asset/images/pronet-logo/

    tag is not being parsed on output.  Is there a way to get EE to parse this tag?  I’m using EE version 2.13 and have PHP parsing at input selected in my template file.  The code I’m using is below.

    {exp:query sql="SELECT * FROM exp_simple_commerce_purchases 
            
            JOIN  exp_simple_commerce_items ON exp_simple_commerce_items.item_id = exp_simple_commerce_purchases.item_id
    
        JOIN  exp_channel_data ON  exp_simple_commerce_items.entry_id = exp_channel_data.entry_id
    
            WHERE exp_simple_commerce_purchases.member_id = '<?php echo $this->EE->session->userdata['member_id'];?>'"}
                    
        <h1>Your Library</h1>
        {field_id_9}
                    
    
        {if no_results}
        <h1>Your Library</h1>
        You have not yet purchased any items for your library.
        {/if}
    
    {/exp:query}


    Thanks!

    P.S.
    I even tried putting the query into a sub-template and embedding it into the main template with the same results.

  • #2 / May 28, 2011 7:12pm

    Mark Bowen

    12637 posts

    Not sure if you’re using 1.x or 2.x here but if 2.x I have a plugin available that you can use to get around the limitation here.

    The query module will jus bring back information exactly as is stored in the database which is why this is happening.

    Give my add-on a go though and see if it helps - Parse File Directories.

    Hope that helps a bit.

    Best wishes,

    Mark

  • #3 / May 28, 2011 7:13pm

    Kernon

    173 posts

    Have you tried moving filedir_4 into the template and leaving it out of the content of your custom field 9?

  • #4 / May 28, 2011 7:34pm

    astronomad

    2 posts

    Thanks Mark!  That did the trick!

    Have you tried moving filedir_4 into the template and leaving it out of the content of your custom field 9?

    The field in question is a EE file field, and EE stores this tag along with the file name on it’s own.

  • #5 / May 28, 2011 7:52pm

    Mark Bowen

    12637 posts

    Thanks Mark!  That did the trick!

    Excellent news. Glad that helped.

    Best wishes,

    Mark

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

ExpressionEngine News!

#eecms, #events, #releases