filter ordering is critical
juancr - November 9, 2007 - 12:06
| Project: | Code Filter |
| Version: | 5.x-1.x-dev |
| Component: | Documentation |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Jump to:
Description
If so, which one should be first? Any particular settings required on the HTML filter?
Thanks,
Juan

#1
On one of my site, I had the following setup:
bbcode > codefilter > html filter > url filter
Not sure if it has to be in this order, but it works for me.
#2
I think this is a documentation issue related to: http://drupal.org/node/32218
#3
I think the proper order is:
But I need to do more testing to make sure.
If Code filter is placed before HTML filter, HTML filter will strip out the color syntax highlighting. If Line break converter is placed before Codefilter, the
<div class="codeblock">blocks are enclosed by<p>paragraph tags; which is obviously invalid XHTML code.#4
Any update on this?
I tried the suggestion by JohnAblin (because I couldn't figure out why I wasn't getting any colored syntax highlighting). But now I'm noticing that I'm only really getting the codeblock div if i actually use the
tag. Just using the php tags doesn't really work.#5
The only reason the <?php ?> tags wouldn't work (that I can think of) is if you are using the PHP evaluator filter. You should only use the PHP evaluator filter if you know what it is, because it can be a security risk if improperly used.
Ryan, did you ADD the PHP evalautor filter to your input filter? If so, remove it immediately. Then the codefilter should work just fine with the ordering I specified above.
I'm leaving this open because trying to do input filtering order voodoo is annoying. I'd like to remove some of the ordering dependencies (issue #32218) and then document it (this issue.)
#6
Hey John,
thanks for the follow up, after I posted this i realized that I hadn't upgraded to the latest version of the filter which conflicted with the recent upgrade to 5.6 and I think that was what was causing the problem. Once I did that, the ordering you proposed seems to work just fine now. Now the php code is colored correctly and has the right divclass on it.
#7
Also - I'm aware of how the php filter works (and its not enabled on any user filters) but I just did a little test and realized that using the order you have listed, you won't actually be able to execute php code. The code filter ends up catching it. My example post was
test
<?php
echo "mytest";
?>
123
<code>
<?php
echo "mytest";
?>
</code>
because I was initially trying to see if I would be able to execute php code and still be able to display code in the same page - imagine a php tutorial page (though i don't plan on doing that) for example
I'm using the same order you posted but without the linebreak or url filters.
#8
You are correct, codefilter will grab the <?php ?> blocks before php filter can get to it. No matter what the order of the filters. That would be a bug: http://drupal.org/node/210912 Thanks!