summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-03-05 17:14:23 +0100
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2014-03-05 17:14:23 +0100
commit7001f876ae8760553f020017cccf90bf0ffbe9df (patch)
tree113fcac1b205402e1c51608a92889dbec5a202af
parentaca6699d789e88c1b5425554d35c13acdd453ead (diff)
parent3e664df641d022903acb060dc40a4815078ac4db (diff)
updates to documentation
-rw-r--r--documentation/functions.html38
-rw-r--r--documentation/install.html12
-rw-r--r--documentation/loading-extensions.html6
-rw-r--r--documentation/parameters.html9
-rw-r--r--documentation/your-first-extension.html8
5 files changed, 25 insertions, 48 deletions
diff --git a/documentation/functions.html b/documentation/functions.html
index 6342e30..60b1d67 100644
--- a/documentation/functions.html
+++ b/documentation/functions.html
@@ -5,14 +5,14 @@
astonishingly simple. As long as you have a native C++ function that has
one of the following four signatures, you can call it almost directly from PHP:
</p>
+
<p>
-<pre class="language-c++"><code>
-void example1();
+<pre class="language-c++"><code>void example1();
void example2(Php::Parameters &amp;params);
Php::Value example3();
-Php::Value example4(Php::Parameters &amp;params);
-</code></pre>
+Php::Value example4(Php::Parameters &amp;params);</code></pre>
</p>
+
<p>
These function signatures show you two important PHP-CPP classes, the
Php::Value class and the Php::Parameters class. The Php::Value class is a
@@ -29,8 +29,7 @@ Php::Value example4(Php::Parameters &amp;params);
name by which the function becomes callable from within your PHP scripts.
</p>
<p>
-<pre class="language-c++"><code>
-#include &lt;phpcpp.h&gt;
+<pre class="language-c++"><code>#include &lt;phpcpp.h&gt;
#include &lt;iostream&gt;
void myFunction()
@@ -44,8 +43,7 @@ extern "C" {
extension.add("myFunction", myFunction);
return extension;
}
-}
-</code></pre>
+}</code></pre>
</p>
<p>
It is not difficult to imagine what the above code does. If you enable
@@ -59,8 +57,7 @@ extern "C" {
want to return a value from your function?
</p>
<p>
-<pre class="language-c++"><code>
-#include &lt;phpcpp.h&gt;
+<pre class="language-c++"><code>#include &lt;phpcpp.h&gt;
#include &lt;stdlib.h&gt;
Php::Value myFunction()
@@ -81,8 +78,7 @@ extern "C" {
extension.add("myFunction", myFunction);
return extension;
}
-}
-</code></pre>
+}</code></pre>
</p>
<p>
Is that cool or not? In PHP it is perfectly legal to make functions that
@@ -95,11 +91,9 @@ extern "C" {
simple PHP script.
</p>
<p>
-<pre class="language-php"><code>
-&lt;?php
+<pre class="language-php"><code>&lt;?php
for ($i=0; $i&lt;10; $i++) echo(myFunction()."\n");
-?&gt;
-</code></pre>
+?&gt;</code></pre>
</p>
<p>
The possible output of this script could for example be:
@@ -125,8 +119,7 @@ string
The following example function that takes a variable number of parameters,
and sums up the integer value of each of the parameters:
</p>
-<pre class="language-c++"><code>
-#include &lt;phpcpp.h&gt;
+<pre class="language-c++"><code>#include &lt;phpcpp.h&gt;
Php::Value sum_everything(Php::Parameters &parameters)
{
@@ -141,8 +134,7 @@ extern "C" {
extension.add("sum_everything", sum_everything);
return extension;
}
-}
-</code></pre>
+}</code></pre>
<p>
The Php::Parameters class is in reality nothing less than a std::vector
filled with Php::Value objects - and you can thus iterate over it. In the
@@ -163,11 +155,9 @@ extern "C" {
PHP script. Let's run a test.
</p>
<p>
-<pre class="language-php"><code>
-&lt;?php
+<pre class="language-php"><code>&lt;?php
echo(sum_everything(10,"100",20)."\n");
-?&gt;
-</code></pre>
+?&gt;</code></pre>
</p>
<p>
The output of the above script is, of course, 130. The "100" string variable
diff --git a/documentation/install.html b/documentation/install.html
index d7e5218..e01a4a8 100644
--- a/documentation/install.html
+++ b/documentation/install.html
@@ -52,8 +52,8 @@
<h2>Download</h2>
<p>
Installation begins with downloading the source code. You can either
- download the latest release from
- <a href="http://www.php-cpp.com">http://www.php-cpp.com</a>, or get the
+ download the latest release from our
+ <a href="http://www.php-cpp.com/download">download</a> page, or get the
latest bleeding edge work-in-progress version from
<a href="https://github.com/CopernicaMarketingSoftware/PHP-CPP">GitHub</a>.
</p>
@@ -82,9 +82,7 @@
the PHP-CPP directory.
</p>
<p>
- <code><pre>
- make
- </pre></code>
+ <pre><code>make</code></pre>
</p>
<p>
The PHP-CPP library has now been built, and all that is left to do is
@@ -93,9 +91,7 @@
logging on as root first.
</p>
<p>
- <code><pre>
- sudo make install
- </pre></code>
+ <pre><code>sudo make install</code></pre>
</p>
<p>
Congratulations! You are now the happy owner of a system with PHP-CPP installed
diff --git a/documentation/loading-extensions.html b/documentation/loading-extensions.html
index 2fb723d..e126743 100644
--- a/documentation/loading-extensions.html
+++ b/documentation/loading-extensions.html
@@ -62,8 +62,7 @@ php -i|grep extension_dir
class that can be used instead.
</p>
<p>
-<pre class="language-c++"><code>
-#include &lt;phpcpp.h&gt;
+<pre class="language-c++"><code>#include &lt;phpcpp.h&gt;
/**
* tell the compiler that the get_module is a pure C function
@@ -88,8 +87,7 @@ extern "C" {
// return the extension
return myExtension;
}
-}
-</code></pre>
+}</code></pre>
</p>
<p>
In the example above you see a very straightforward implementation of the
diff --git a/documentation/parameters.html b/documentation/parameters.html
index 5c39a55..38f494c 100644
--- a/documentation/parameters.html
+++ b/documentation/parameters.html
@@ -13,8 +13,7 @@
the parameters is:
</p>
<p>
-<pre class="language-c++"><code>
-#include &lt;phpcpp.h&gt;
+<pre class="language-c++"><code>#include &lt;phpcpp.h&gt;
void example(Php::Parameters &amp;params)
{
@@ -30,8 +29,7 @@ extern "C" {
});
return myExtension;
}
-}
-</pre></code>
+}</pre></code>
</p>
<p>
Above you see that we passed in additional information when we registered the
@@ -268,6 +266,3 @@ swap(10,20);
?&gt;
</code></pre>
</p>
-
-
- \ No newline at end of file
diff --git a/documentation/your-first-extension.html b/documentation/your-first-extension.html
index 02d85cd..cebc44f 100644
--- a/documentation/your-first-extension.html
+++ b/documentation/your-first-extension.html
@@ -196,8 +196,7 @@ extension=yourextension.so
all your functions and classes to it.
</p>
<p>
-<pre class="language-c++"><code>
-#include &lt;phpcpp.h&gt;
+<pre class="language-c++"><code>#include &lt;phpcpp.h&gt;
/**
* tell the compiler that the get_module is a pure C function
@@ -222,8 +221,7 @@ extern "C" {
// return the extension
return extension;
}
-}
-</code></pre>
+}</code></pre>
</p>
- \ No newline at end of file
+