Until recently I have been using the following to print formatted text from a field in flexinode:

<?php print check_output($node->flexinode_20); ?>

flexinode_20 is text field

The problem is even when I have "Full HTML" checked check_output() is stripping all HTML I put in the field. Has anyone had this problem or figured it out? Thanks and major props to anyone that can help me out.

Comments

thinkinkless’s picture

I did a bunch of flexinode themeing last night and had no issues with check_output. It worked great. (4.6.3 w/freetagging backport) What version are you using?

My first instinct on your problem is that it's stripping tags based on the permissions of the user.

Did you check to see if the author has html permissions?

Also, did you check your content filter to make sure the tags you are using are allowed?

robomalo’s picture

I have Drupal 4.6.3 installed, the permissions are set, and I have typed in the appropriate tags in "Allowed HTML Tags." It's strange because check_output() gives me the correct quotes, mdashes, etc, as provided by Markdown and our other content filters. It just strips any HTML tags I insert in the field.

We can verify that our content filter settings are correct because <?php print $content ?> produces the results we want, and includes all HTML tags and style attributes. However, we need to output the content one flexinode field at a time.

<?php print check_output($node->flexinode_20); ?> gives us the control we need, but it seems to ignore our content filter settings, and strips HTML information that would have been included by <?php print $content ?>.

Any other thoughts?

Zach Harkey’s picture

I had this same thing happen to me the other day. I'm trying to remember what was causing it. Hmm... I was using Markdown too, and that was the input type that wasn't being parsed.

Does it happen regardless of which input type you choose? Did you try all of them(Filtered HTML, Full HTML, PHP etc.)? Did any of them parse? I think for me it might have just been Markdown or something.

And I think I became convinced it was some kind of a caching issue. So I went through several methodical reset steps and I got it to start working again.

I'm not sure exactly which one was the silver bullet, but here are all of the steps I did (some of which I;m sure are overkill):

- Empty the drupal db cache TRUNCATE TABLE `cache`
- Go to admin/modules and deactivate any input related modules(markdown) / submit / then reactivate them / submit

- Input formats are each assigned a unique id. If you have recently made any changes (create/delete/rename/etc.) in this area, make sure that your node in question is not using a bunk format id.

I think I ended up creating a completely new input format called "MarkdownWTF" then created a completely new flexinode, selected my new "MarkdownWTF" input format, and made a couple markdown style [links](http://daringfireball.com), and submitted it. At some point things started working again, and I may have killed the old input type, then just used an sql query on the node table to replace all format 3's with format 4's or something.

Point is, it's something like that.

-zach
------------------------
harkey design

: z

robomalo’s picture

We finally figured it out. It was because we weren't putting an opening tag first in the text field. We just wanted a div to float right in the container after some content.

This didn't work:

content

<div>floating content</div>

But this did:

<div>content</div>

<div>floating content</div>

Talk about annoying. Thanks for your input! The advice helped further our understanding of how Drupal works.

Steven’s picture

You need to pass the selected format from $node to check_output().

--
If you have a problem, please search before posting a question.

Zach Harkey’s picture

Actually you don't, unless you want to hardcode it into the template, which seems like a bad idea. It's supposed to use the selected input format by default.

-zach
------------------------
harkey design

: z

Steven’s picture

Err no. If you don't pass a format to check_output(), it will use the site-wide default format. Not the one you selected when you created the node in question.

I did not say hardcoding though. I meant passing $node->format to check_output.

--
If you have a problem, please search before posting a question.

robomalo’s picture

<?php print check_output($node->flexinode_n, $node->format, $check = TRUE); ?>

This in combination with my post above made it work for us.

robomalo’s picture

I took out the ", $node->format, $check = TRUE" and it still worked properly.

19th’s picture

$node->format is allways 0 for flexinode nodes, so use $node->flexinode_n_format.
According to drupaldocs.org API reference, you should specify $check = FALSE when viewing other people's content (it's default value).

<?php print check_output($node->flexinode_n, $node->flexinode_n_format); ?>
robomalo’s picture

I have added a dropdown menu option in one of our flexinodes. When I theme and code <?php print $node->flexinode_n; ?>, rather than getting the options in the dropdown menu, I get the number of the options: 1, 2... What should I wrap around $node->flexinode_n to get the formatted options? Thanks.

John Robinson Jr.

veelo’s picture

 print check_markup($node->flexinode_n, $node->flexinode_n_format, FALSE);

Bastiaan Veelo.

Zach Harkey’s picture

Whoa Steven, you're right. I never noticed this because when I use a flexinode, it is mainly to keep the user from having to do too much fancy formatting, so the default has always been fine. Of course now that I think back on it, it wasn't _always_ fine after all...

: z