- Drupal FAQ
- Drupal for Administrators
- Drupal for Users
- How to add comments to the pages
- How to add pages to this site
- How to create a cross-reference to another page
- How to create a link to an existing (external) page?
- How to create a weekly meeting
- How to modify existing page
- How to organize contents into groupings?
- I would like to display code - How to do this?
- Public and Private pages
- STAR modules
- Themes
I would like to display code - How to do this?
Submitted by jlauret on Tue, 2006-12-26 21:44
Under:
Code can be displayed in filtered HTML or full HTML. To display code, you have two solutions:
unlike the use of <pre></pre> which would display
but, if you use the Full HTML mode, you could also "force" perl formating by using
- Use the regular <pre></pre> HTML tags
- Use the <code></code> tag
<code>which will be displayed as
#!/usr/local/bin/perl
use DBI;
print "Hello world\n";
</code>
#!/usr/local/bin/perl
use DBI;
print "Hello world\n";#!/usr/local/bin/perl
use DBI;
print "Hello world\n";
but, if you use the Full HTML mode, you could also "force" perl formating by using
<code type="perl">which will display exactly the same as above.
use DBI;
print "Hello world\n";
</code>
WARNING: Note that switching between enable rich-text and normal mode while using <code> may scramble your formating. This was also noted in How to create a cross-reference to another page.
