Metainformationen zur Seite
  •  

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Nächste Überarbeitung
Vorhergehende Überarbeitung
wiki:syntax [13.11.2021] – Externe Bearbeitung 127.0.0.1wiki:syntax [11.11.2024] (aktuell) – Externe Bearbeitung 127.0.0.1
Zeile 369: Zeile 369:
 ==== Syntax Highlighting ==== ==== Syntax Highlighting ====
  
-[[wiki:DokuWiki]] can highlight sourcecode, which makes it easier to read. It uses the [[http://qbnz.com/highlighter/|GeSHi]] Generic Syntax Highlighter -- so any language supported by GeSHi is supported. The syntax uses the same code and file blocks described in the previous section, but this time the name of the language syntax to be highlighted is included inside the tag, e.g. ''<nowiki><code java></nowiki>'' or ''<nowiki><file java></nowiki>''.+[[wiki:dokuwiki]] can highlight sourcecode, which makes it easier to read. It uses the [[http://qbnz.com/highlighter/|GeSHi]] Generic Syntax Highlighter -- so any language supported by GeSHi is supported. The syntax uses the same code and file blocks described in the previous section, but this time the name of the language syntax to be highlighted is included inside the tag, e.g. ''<nowiki><code java></nowiki>'' or ''<nowiki><file java></nowiki>''.
  
-<code java>+<code java [enable_line_numbers="true"]>
 /** /**
  * The HelloWorldApp class implements an application that  * The HelloWorldApp class implements an application that
Zeile 389: Zeile 389:
 When you use the ''%%<code>%%'' or ''%%<file>%%'' syntax as above, you might want to make the shown code available for download as well. You can do this by specifying a file name after language code like this: When you use the ''%%<code>%%'' or ''%%<file>%%'' syntax as above, you might want to make the shown code available for download as well. You can do this by specifying a file name after language code like this:
  
-<code>+<code php [enable_line_numbers="true"]> 
 +<file php myexample.php>
 <file php myexample.php> <file php myexample.php>
 <?php echo "hello world!"; ?> <?php echo "hello world!"; ?>
Zeile 402: Zeile 403:
  
  
-===== Embedding HTML and PHP =====+===== Embedding HTML, JavaScript and PHP =====
  
-You can embed raw HTML or PHP code into your documents by using the ''%%<html>%%'' or ''%%<php>%%'' tags. (Use uppercase tags if you need to enclose block level elements.)+You can embed raw HTML, JavaScript or PHP code into your documents by using the ''%%<html>%%'' or ''%%<php>%%'' tags. (Use uppercase tags if you need to enclose block level elements.)
  
-HTML example:+==== HTML example: ====
  
-<code>+ 
 +<code html [enable_line_numbers="true"]>
 <html> <html>
-This is some <span style="color:red;font-size:150%;">inline HTML</span>+  This is some <span style="color:red;font-size:150%;">inline HTML</span>
 </html> </html>
-<HTML> 
-<p style="border:2px dashed red;">And this is some block HTML</p> 
-</HTML> 
 </code> </code>
  
Zeile 420: Zeile 419:
 This is some <span style="color:red;font-size:150%;">inline HTML</span> This is some <span style="color:red;font-size:150%;">inline HTML</span>
 </html> </html>
 +
 +<code html [enable_line_numbers="true"]>
 +<HTML>
 +  <p style="border:2px dashed red;">And this is some block HTML</p>
 +</HTML>
 +</code>
 +
 <HTML> <HTML>
 <p style="border:2px dashed red;">And this is some block HTML</p> <p style="border:2px dashed red;">And this is some block HTML</p>
 </HTML> </HTML>
  
-PHP example:+==== JavaScript ====
  
-<code>+<code javascript> 
 +<JS> 
 +// the hello world program 
 +document.write('Hello, World!'); 
 +</JS> 
 + 
 +</code> 
 + 
 +<JS> 
 +// the hello world program 
 +document.write('Hello, World!'); 
 +</JS> 
 + 
 +==== PHP example: ==== 
 + 
 +<code php [enable_line_numbers="true"]>
 <php> <php>
-echo 'A logo generated by PHP:'; +  echo 'A logo generated by PHP:'; 
-echo '<img src="' . $_SERVER['PHP_SELF'] . '?=' . php_logo_guid() . '" alt="PHP Logo !" />'; +  echo '<img src="' . $_SERVER['PHP_SELF'] . '?=' . php_logo_guid() . '" alt="PHP Logo !" />'; 
-echo '(generated inline HTML)';+  echo '(generated inline HTML)';
 </php> </php>
 +</code>
 +
 +<code php [enable_line_numbers="true"]>
 <PHP> <PHP>
 echo '<table class="inline"><tr><td>The same, but inside a block level element:</td>'; echo '<table class="inline"><tr><td>The same, but inside a block level element:</td>';
Zeile 439: Zeile 463:
 </code> </code>
  
 +<code  php [enable_line_numbers="true"]>
 <php> <php>
-echo 'A logo generated by PHP:'; +  echo 'The PHP version: '; 
-echo '<img src="' . $_SERVER['PHP_SELF'] . '?=' . php_logo_guid() . '" alt="PHP Logo !" />'+  echo phpversion(); 
-echo '(inline HTML)';+  echo ' (generated inline HTML)';
 </php> </php>
 +</code>
 +
 +<php> echo 'The PHP version: '; echo phpversion(); echo ' (generated inline HTML)'; </php>
 +
 +<code php [enable_line_numbers="true"]>
 <PHP> <PHP>
-echo '<table class="inline"><tr><td>The same, but inside a block level element:</td>'; +  echo '<table class="inline"> <tr> <td>The PHP version inside a block level element: </td>'; 
-echo '<td><img src="' . $_SERVER['PHP_SELF'] . '?=' . php_logo_guid() . '" alt="PHP Logo !" /></td>'; +  echo '<td>'.phpversion().'</td>'; 
-echo '</tr></table>';+  echo '</tr></table>';
 </PHP> </PHP>
 +</code>
 +
 +<PHP> echo '<table class="inline"> <tr> <td>The PHP version inside a block level element: </td>'; echo '<td>'.phpversion().'</td>'; echo '</tr></table>'; </PHP>
  
 **Please Note**: HTML and PHP embedding is disabled by default in the configuration. If disabled, the code is displayed instead of executed. **Please Note**: HTML and PHP embedding is disabled by default in the configuration. If disabled, the code is displayed instead of executed.
Zeile 463: Zeile 496:
 | //n//[dhm] | refresh period, where d=days, h=hours, m=minutes. (e.g. 12h = 12 hours). | | //n//[dhm] | refresh period, where d=days, h=hours, m=minutes. (e.g. 12h = 12 hours). |
  
-The refresh period defaults to 4 hours. Any value below 10 minutes will be treated as 10 minutes. [[wiki:DokuWiki]] will generally try to supply a cached version of a page, obviously this is inappropriate when the page contains dynamic external content. The parameter tells [[wiki:DokuWiki]] to re-render the page if it is more than //refresh period// since the page was last rendered.+The refresh period defaults to 4 hours. Any value below 10 minutes will be treated as 10 minutes. [[wiki:dokuwiki]] will generally try to supply a cached version of a page, obviously this is inappropriate when the page contains dynamic external content. The parameter tells [[wiki:dokuwiki]] to re-render the page if it is more than //refresh period// since the page was last rendered.
  
 **Example:** **Example:**