Login Register

Forums now supports <code> tag for most common langages

Here are a few examples of how this works using PHP, HTML, Javascript, HTML and CSS Supported languages: html4script, php, javascript, asp, java, diff, patch, java, java5, mysql (HTML isnt usable by non committers just yet due to a conflict with the filtered HTML processor)
//<code lang="css">
<style>
body {
        margin: 2px;
        padding: 2px;
}
.box {
  position: relative;
        background-color: white;
        border: 2px solid black;
        padding: 8px;
        margin: 4px;
}
</style>
//javascript using <code lang="javascript">
for(var i=0;i<10;i++){
  echo 'this is javascript!';
}
  1. //this is using <code lang="php" start> apparently you cant use the PHP tags inside this just yet...
  2. $conn = mysql_connect('localhost', 'user','pass');
  3. $db = mysql_select_db('database');
  4. $r = mysql_query("SELECT * FROM test WHERE 1");
  5. while($row = mysql_fetch_assoc($r)){
  6.         print_r($row);
  7. }
This is formatted with <code lang="html4strict" start> tags
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2.  
  3. <title>Dojo Widgets being loaded inside of a ContentPane and still working</title>
  4.  
  5. <script type="text/javascript">
  6.         var djConfig = {isDebug: true};
  7. </script>
  8. <script type="text/javascript" src="dojo/dojo.js"></script>
  9. <script language="JavaScript" type="text/javascript">
  10.         dojo.require("dojo.widget.ContentPane");
  11. </script>
  12. </head>
  13.  
  14. This text is before the content pane in the dom structure.
  15.  
  16. <div dojoType="ContentPane" class="box" id="test" executeScripts="true" parseContent="true" href="contract.php?id=1">
  17.  
  18. </div>
  19.  
  20. <script type="text/javascript">
  21.         dojo.addOnLoad(function(){
  22.                 dojo.event.connect(dojo.widget.byId('test'),'onLoad','init');
  23.         });
  24.         function init(){
  25.                 dojo.debug('test has loaded');
  26.         }
  27. </script>
  28. This text is after the content pane in the dom structure and if you look at the source you will see we are loading a page that contains widget using the href attribute of the Dojo ContentPane.
  29. </body>
  30. </html>

*awesome*. Thanks

*awesome*. Thanks Karl!

--
Project Lead, The Dojo Toolkit
President, The Dojo Foundation