First prepare your maven settings. Follow the instructions from the instruction from the opencube page
.
Than follow the 5 minutes starter guide (for PHP 5)
from php-maven webpage.
Create a new eclipse project and point the basedir to the created maven project.
Open your pom and add following dependencies.
<dependencies> ... <dependency> <groupId>org.opencube</groupId> <artifactId>phpcube-php5</artifactId> <version>1.0</version> </dependency> <dependency> <groupId>org.opencube</groupId> <artifactId>config-default</artifactId> <version>1.1</version> </dependency> .... </dependencies>
set_include_path('../php'.PATH_SEPARATOR.'../../../target/phpinc');
So now we load our first phpCube document.
To create an phpCube document you have to create two folder under "src/main/php/" "myapp/designs".
"myapp" is the application namespace folder and can be differnt. The designs folder is a phpCube convention.
We will call our phpCube template "hellophpcube.htm".
<cube:stylesheet> <html> <body> Hello phpCube </body> </html> </cube:stylesheet>
<?php
set_include_path ( '../php' . PATH_SEPARATOR . '../../../target/phpinc' );
require_once str_replace ( '.', '/', 'org.sample' ) . '/app.php';
require_once ('cube/controller.php');
$page = new cube_page ( 'sample project', $_REQUEST );
$file = "org/sample/myapp/designs/hellophpcube.htm";
$page->loadFile ( $file, 1 );
echo $page->transform();
?>