3

I know you can change them globally from the Admin menu, but what I was hoping for was someway to temporarily ignore the field formatting selected and simply output the data in the field.

Why? I have a bunch of Smartdown fields (Markdown) that I want to actually show the pre-parsed MD -- without actually changing the formatting of the field.

2

Have a look at Single Field - it can grab your raw data using its field_format="raw" parameter.

Or, just use the Query module:

{exp:query sql="SELECT field_id_XX FROM exp_channel_data WHERE entry_id = XX"}
    {field_id_XX}
{/exp:query}
4
  • The Query module works great, but unfortunately I lose all line breaks. Is there any way to output raw data with those line breaks still in there? – Jim Hull Mar 1 '13 at 17:50
  • That's odd. Do you mean spaces between paragraphs? Or manual Markdown line breaks (3 spaces)? – Derek Hogue Mar 1 '13 at 17:58
  • Spaces between paragraphs. I get the raw pre-Markdown formatted data, but it's one giant run-on sentence. – Jim Hull Mar 1 '13 at 18:28
  • On the page, or in the source code? Try outputting it within <pre> tags. – Derek Hogue Mar 1 '13 at 19:31
2

I think this might be the random case, where Derek Jones' No Formatting might come in use. It can be used directly on the template like:

{exp:no_formatting}{my_field}{/exp:no_formatting}

And should return just the string of text from the field. I emphasize should because I've never used it with 'Markdown' in a field.

3
  • This won't work. Formatting is applied to the field before it hits the template, and the No Formatting plugin simply returns exactly the same data inside it. – Low Feb 27 '13 at 9:40
  • Ahh… so this would almost be the same as the display code issue then, except for the field_type he's using. So, then since Markdown requires separate parsing then say, just HTML, couldn't he just change the field_type to say textarea and then the Markdown would be displayed. Or Derek's suggestion of 'Single Field' add-on. – nonprofit_tech Feb 27 '13 at 11:58
  • Yes, that would be possible. set the fieldtype to no-formatting and use the plugin separately in the template to format markdown for the field when needed. – GDmac Feb 27 '13 at 13:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.