Writing tips and the text formats provided

Top

Text Formats

We use 4 text format on the site for writing contents such as blogs, articles, questions etc. They are Filtered Html, Full Html, PHP code, and Plain Text. Based on your permission and access level, you are displayed some of these Text formats if not all so do not be surprise if you can't find all the options mentioned here.

This page explains the type of restrictions you might encounter while writing on the site depending on the option chosen.

 

Filtered HTML

Use this option to write a quick note. Below are the options provided:

  • Web page addresses and e-mail addresses turn into links automatically.
  • Colouring of text is possible
  • Styling is allowed in this text format
  • You can also add media: images and videos (e.g. youtube videos)
  • Smilies are also provided

 

Full HTML

Use this option for best editing and to get experience in the editor pane. In addition to the features provided filtered html, Full html provides you with more options. Note, this option might not be visible due to permissions you have.

  • With Full Html, Syntax highlighting of source code can be enabled using the code button in the editor at the top.

  • Lines and paragraphs are automatically recognized. The <br /> line break, <p> paragraph and </p> close paragraph tags are inserted automatically. If paragraphs are not recognized simply add a couple blank lines.

  • Web page addresses and e-mail addresses turn into links automatically.

  • Syntax highlighting of source code can be enabled with the following tags:
    • Generic syntax highlighting tags: "<code>", "<blockcode>".
    • Language specific syntax highlighting tags: "<language-cs>" for C# source code, "<language-css>" for CSS source code, "<language-html>" for HTML source code, "<language-java>" for Java source code, "<language-javascript>" for Javascript source code, "<language-mysql>" for MySQL source code, "<language-php>" for PHP source code, "<language-python>" for Python source code, "<ruby>" for Ruby source code, "<language-sql>" for SQL source code, "<language-xml>" for XML source code.
    • PHP source code can also be enclosed in <?php ... ?> or <% ... %>, but additional options like line numbering are not possible here.

 

Examples 

You type You get
<code>foo = "bar";</code> Inline code with the default syntax highlighting mode.
  1. <code><br />
  2. foo = "bar";<br />
  3. baz = "foz";<br />
  4. </code>
Code block with the default syntax highlighting mode.
  1. <code lang="javascript" linenumbers="normal"><br />
  2. foo = "bar";<br />
  3. baz = "foz";<br />
  4. </code>
Code block with syntax highlighting for Javascript source code
and normal line numbers.
  1. <code language="javascript" start="23" fancy="7"><br />
  2. foo = "bar";<br />
  3. baz = "foz";<br />
  4. </code>
Code block with syntax highlighting for Javascript source code,
line numbers starting from 23
and highlighted line numbers every 7th line.
  1. <language-cs><br />
  2. foo = "bar";<br />
  3. baz = "foz";<br />
  4. </language-cs>
Code block with syntax highlighting for C# source code.
  1. <language-cs start="23" fancy="7"><br />
  2. foo = "bar";<br />
  3. baz = "foz";<br />
  4. <language-cs>
Code block with syntax highlighting for C# source code,
line numbers starting from 23
and highlighted line numbers every 7th line.
 

 

Plain Text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs are automatically recognized. The <br /> line break, <p> paragraph and </p> close paragraph tags are inserted automatically. If paragraphs are not recognized simply add a couple blank lines.

 

PHP Code

This format allows you to run php code on the page. Note, this option might not be visible due to permissions you have.

Custom PHP code may be embedded in some types of site content, including posts. While embedding PHP code inside a post is a powerful and flexible feature when used by a trusted user with PHP experience, it is a significant and dangerous security risk when used improperly. Even a small mistake when posting PHP code may accidentally compromise our site.

If you are unfamiliar with PHP, SQL, avoid using custom PHP code within posts. Experimenting with PHP may corrupt your database, render your site inoperable, or significantly compromise security.

Notes:

  • Remember to double-check each line for syntax and logic errors before saving.
  • Statements must be correctly terminated with semicolons.
  • Global variables used within your PHP code retain their values after your script executes.
  • register_globals is turned off. If you need to use forms, understand and use the functions in the Drupal Form API.
  • Use a print or return statement in your code to output content.
  • Develop and test your PHP code using a separate test script and sample database before deploying on a production site.
  • Consider including your custom PHP code within a site-specific module or template.php file rather than embedding it directly into a post.

 

If any questions, please post comment below...

I hope you can continue to write properly and thanks for helping to improve our sitewink

 

Share this page...

Twitter icon
Facebook icon
Google icon
StumbleUpon icon
Del.icio.us icon
Digg icon
LinkedIn icon
MySpace icon
Newsvine icon
Pinterest icon
Reddit icon
Technorati icon
Yahoo! icon
e-mail icon