Drupal.org's PHP input format
how does Drupal.org do its PHP input filter?
the one that if you put PHP tags around it it will make nicely formatted and colored code
(may have posted this question on agaric)
Thanks Lullabot!
http://www.lullabot.com/articles/drupal_input_formats_and_filters
Code Filter Renders syntax-highlighted PHP code. This module is used on Drupal.org.
http://drupal.org/project/codefilter
See more input filters in the Filters and Editors category:
http://drupal.org/project/Modules/category/63
An example of the codefilter input format making PHP all pretty:
<?php
print "Oh joy it works!";
?>
And for Dan, a test to see if it will do the in-page horizontal scrollbar so that it will not break the formatting of these carefully crafted pages:
<?php
drupal_set_message("Just put php tags of the real kind around your code, and after enabling the codefilter module, and adding the Code filter on your desired input formats (Filtered HTML and Full HTML recommended, enabling it on real PHP input decidedly not recommended!), you'll be able to make silly text like this!");
// a reminder though, you should mention to your readers
/* The <?php and
?>
tags are for the purpose of the example only
and in their real code, they may already be in PHP code, or for most Drupal
modules, only the beginning php tag is used
*/
?>
Comments
Note that the above
Note that the above demonstrates that a) the code filter appears to choose to wrap code rather than causing a horizontal bar, and b) putting >?php tags in the format-initiating php tags used messes things up, apparently destroying an entire line above.
<?php
/* That line
was part of
a multiline comment
which evidently works.
*/
?>
Post new comment