The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]

Поиск:  Каталог документации

6.2. The Pike tag

For a complete tutorial and reference manual on Pike, see

The Pike tag allows you to easily insert Pike code into your HTML page Ю la PHP. This is a good way of learning Pike if you have a PHP background or if you want to do things very easily and don't worry about perfect results.

To do this, you have to load a module in your server. Just select Load module in the CIF. and click the "Pike tag" image. Then hit save and create an .html file where your public web files are. Since everybody tells me that PHP is easy, which is why it's so popular, I took the PHP examples and converted them to Pike. Here is the result:

Example 6-2. The PHP documentation as a Pike tag.

  <body bgcolor="#FFFFFF">
    <h2>Escaping from HTML</h2>
      There is one way of escaping from HTML and entering "Pike code mode"
      <br />
	output("This is the simplest, and SGML processing instruction");
    <h2>Instruction separation</h2>
      Instructions are separated the same as in C or Perl: 
      terminate each statement with a semicolon. 
      The closing tag (container, in fact) also implies the end of the statement,
      so the following are equivalent:
      <br />
	output ("This is a test");
      <br />
      <Pike> output ("This is a test"); </Pike>
      Pike supports C, C++ but not Unix shell-style comments. For example:
	string tests = "This is a test<br />";  // this is a one-line C++ style comment
	/* This is a multi line comment
         yet another line of comment */
	tests += "Yet another test";
	return tests;
    <h2>Melding RXML and Pike</h2>
    You will never see this in PHP.
    This will create a .gif image of 1-2-...-255. 
    This took 0.4s on my Duron 750 the first time and 0.1s after.
      <gtext scale=0.5>
	  string output = "";
	  for(int I = 1; I < 255; I++) 
	    output += I + "-";
	  return output;

The problem with using this is that you will soon see it is not powerful:

The next step is to write your first Pike script.



In fact you can... just compile PHP for Caudium :)

Inferno Solutions
Hosting by

Закладки на сайте
Проследить за страницей
Created 1996-2024 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру