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.

Custom query using Query module not returning carriage return characters

October 07, 2008 11:50am

Subscribe [2]
  • #1 / Oct 07, 2008 11:50am

    mhancock

    9 posts

    I am using the Query module to perform a custom query and I am having problems.  Currently I have (2) fields that are defined to be Xhtml type and contain character data along with numerous embedded carriage returns for formatting.  When I query those fields and display them to the page, the carriage returns are not processed so my data runs together.  Any help would be appreciated…

    Partial code follows:

    {exp:query sql="SELECT entry_id, field_id_32 as q_pro_text_upper, field_id_33 as q_pro_text_lower, field_id_30 as q_pro_name,
    field_id_34 as q_pro_image_1, field_id_35 as q_pro_image_1_thumb,
    field_id_36 as q_pro_image_2, field_id_37 as q_pro_image_2_thumb,
    field_id_38 as q_pro_image_3, field_id_39 as q_pro_image_3_thumb,
    field_id_42 as q_pro_image_4, field_id_43 as q_pro_image_4_thumb,
    field_id_44 as q_pro_image_5, field_id_45 as q_pro_image_5_thumb,
    field_id_46 as q_pro_image_6, field_id_47 as q_pro_image_6_thumb
    FROM exp_weblog_data
    WHERE entry_id = '<?php echo $entry_id?>' "}

    <div id=“theContent”>
      <div class=“hideMe” id=“divWithGallery”>
          <div class=“projectInfo”>
            <div id=“pro_name”>

    {q_pro_name}

    </div>
            <div id=“pro_text_upper”>{q_pro_text_upper}

    </div>
            <div id=“pro_text_lower”>{q_pro_text_lower}</div>
          </div>
    .
    .
    .

    Thanks for any help…

  • #2 / Oct 07, 2008 11:58am

    Sue Crocker

    26054 posts

    You may need to use the following plugin:

    xhtl Typography

  • #3 / Oct 07, 2008 12:00pm

    Robin Sowell

    13255 posts

    Ah- it’s because in a weblog tag, the fields are run through the typography class.  The query module doesn’t do that- for good reason.  But- check out the EE Typography plugin- you can use that to parse the bits that need parsing.  Will that do the trick?

  • #4 / Oct 07, 2008 12:05pm

    mhancock

    9 posts

    So I end up using the plugin AFTER I perform my custom query while I am formatting it for use on my page?

    <div id=“pro_text_upper”><exp:xhtml:light>{q_pro_text_upper}</exp:xhtml:light>

    </div>

    Thanks

  • #5 / Oct 07, 2008 12:16pm

    Robin Sowell

    13255 posts

    Right- when I do it, I often don’t use it on all fields.  Just depends a bit.

  • #6 / Oct 07, 2008 12:18pm

    mhancock

    9 posts

    Just tried using the xhtml plugin with no luck.  I tried using it in both mode (light and full).

    <div id=“pro_text_upper”><exp:xhtml:light>{q_pro_text_upper}</exp:xhtml:light>

    </div>
    or
    <div id=“pro_text_upper”><exp:xhtml:full>{q_pro_text_upper}</exp:xhtml:full>

    </div>

    Is the syntax correct?

  • #7 / Oct 07, 2008 12:20pm

    mhancock

    9 posts

    Let me try using the ee_typography plugin…

  • #8 / Oct 07, 2008 12:36pm

    mhancock

    9 posts

    Not working as shown below…

    {exp:query sql="SELECT entry_id, field_id_32 as q_pro_text_upper, field_id_33 as q_pro_text_lower, field_id_30 as q_pro_name,
    field_id_34 as q_pro_image_1, field_id_35 as q_pro_image_1_thumb,
    field_id_36 as q_pro_image_2, field_id_37 as q_pro_image_2_thumb,
    field_id_38 as q_pro_image_3, field_id_39 as q_pro_image_3_thumb,
    field_id_42 as q_pro_image_4, field_id_43 as q_pro_image_4_thumb,
    field_id_44 as q_pro_image_5, field_id_45 as q_pro_image_5_thumb,
    field_id_46 as q_pro_image_6, field_id_47 as q_pro_image_6_thumb
    FROM exp_weblog_data
    WHERE entry_id = '<?php echo $entry_id?>' "}

    <div id=“theContent”>
      <div class=“hideMe” id=“divWithGallery”>
          <div class=“projectInfo”>
            <div id=“pro_name”>

    {q_pro_name}

    </div>
            <div id=“pro_text_upper”><exp:ee_typography>{q_pro_text_upper}</exp:ee_typography>

    </div>
            <div id=“pro_text_lower”><exp:ee_typography>{q_pro_text_lower}</exp:ee_typography></div>
          </div>
    ...

    I double checked the weblog entry and yes it does have line breaks showing white space…

    Any suggestions…

  • #9 / Oct 07, 2008 12:38pm

    mhancock

    9 posts

    Nevermind…

    <div id=“pro_text_upper”><exp:ee_typography>{q_pro_text_upper}</exp:ee_typography>

    </div>

    should be

    <div id=“pro_text_upper”>{exp:ee_typography}{q_pro_text_upper}{/exp:ee_typography}

    </div>

    oops…

    Thanks for the help…
    Problem resolved…

  • #10 / Oct 07, 2008 12:41pm

    Robin Sowell

    13255 posts

    Just tested- it defaulted to xhmtl format doing:

    {exp:query sql="SELECT title, field_id_13 as body FROM exp_weblog_titles t, exp_weblog_data d WHERE t.entry_id = d.entry_id AND field_id_13 != '' ORDER BY entry_date DESC LIMIT 5"}
    {title}
    
    {exp:ee_typography}
    {body}
    {/exp:ee_typography}
    <hr>
    {/exp:query}

    That working for you?

  • #11 / Oct 07, 2008 12:41pm

    Robin Sowell

    13255 posts

    Heh- xpost!  Have you definitely got it squared away now?

  • #12 / Oct 07, 2008 12:43pm

    mhancock

    9 posts

    Is all OK now!!!

    Thanks for the help…

  • #13 / Oct 07, 2008 12:44pm

    Robin Sowell

    13255 posts

    Glad you’re squared away!

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

ExpressionEngine News!

#eecms, #events, #releases