Panglossa go!Johnny PHP class library go!Johnny Developer Blog
Status: Beta
Brought to you by:
panglossa
The go!Johnny library is not provided in any special package type like e.g. PEAR. You just have to download the latest version, unpack it to your server and then include the main file in your PHP scripts. There are only two options you have to define (constants GJ_PATH_LOCAL and GJ_PATH_WEB), in case your scripts are located in a folder other than that of the library (which is mostly the case).
Example:
<?php define(GJ_PATH_LOCAL, '../gojohnny7'); define(GJ_PATH_WEB, 'http://myserveraddress/gojohnny7'); require_once(GJ_PATH_LOCAL . DIRECTORY_SEPARATOR . 'gjmain.php');
After you do this, you can start using go!Johnny classes. Let's see an example of a complete page created with go!Johnny:
<?php define(GJ_PATH_LOCAL, '../gojohnny7'); define(GJ_PATH_WEB, 'http://myserveraddress/gojohnny7'); require_once(GJ_PATH_LOCAL . DIRECTORY_SEPARATOR . 'gjmain.php'); $page = TPage('Welcome to my home page!'); $page->icon = 'myicon.ico'; $page->css[] = 'mystyle.css'; $page->js[] = 'myscripts.js'; $page->add(TH1('Welcome!')); $page->add(TImg('construction.png', 'Under Construction')); $page->add(TP('Sorry, my web page is still under construction.')); $page->render(); ?>
When you do this, you will be generating the following HTML5 markup:
<!DOCTYPE html> <html> <head> <!-- starting page head section --> <!-- starting page meta section --> <meta http-equiv="Content-Type" content="text/html; charset=us-ascii" /> <meta http-equiv="Expires" content="0" /> <meta http-equiv="Pragma" content="no-cache" /> <meta http-equiv="Cache-Control" content="no-cache" /> <meta name="language" content="en" /> <meta name="robots" content="index,follow" /> <meta name="coverage" content="Worldwide" /> <meta name="distribution" content="Global" /> <meta name="rating" content="General" /><!-- finishing page meta section --> <title> go!Johnny </title> <link rel="icon" href="myicon.ico" type="image/x-icon" /> <link rel="stylesheet" href="http://myserveraddress/gojohnny/lib/bootstrap/css/bootstrap.css" type="text/css" /> <link rel="stylesheet" href="http://myserveraddress/gojohnny/gojohnny.css" type="text/css" /> <link rel="stylesheet" href="http://myserveraddress/gojohnny/fonts.css.php" type="text/css" /> <link rel="stylesheet" href="mystyle.css" type="text/css" /> <script src="http://myserveraddress/gojohnny/lib/jquery/jquery.js" type="text/javascript"></script> <script src="http://localhost/_gojohnny7/gojohnny.js" type="text/javascript"></script> <script src="myscripts.js" type="text/javascript"></script> <!-- finishing page head section --> </head> <body> <!-- starting page body section --> <div id="main" class="container-fluid"> <h1> Welcome! </h1><img src="construction.png" alt="Under Construction" /> <p> Sorry, my web page is still under construction. </p> </div> <!-- finishing page body section --> </body> </html>