PHP Classes

File: Book_Example.php

Recommend this page to a friend!
  Classes of Orazio Principe   PHP Microdata Generator   Book_Example.php   Download  
File: Book_Example.php
Role: Example script
Content type: text/plain
Description: Books example microdata
Class: PHP Microdata Generator
Generate semantic HTML tags following schema.org
Author: By
Last change: Accessible without user login
Date: 10 years ago
Size: 1,846 bytes
 

Contents

Class file image Download
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>Microdata for products</title>
    </head>
    <body>
        <?php
       
require_once("MicrodataGenerator.php");

       
$book = new Microdata\Book();
       
$book->setName("example name");
       
$book->setUrl("principeorazio.wordpress.com");
       
$book->setDescription("short description for the product");
       
$book->setAuthor("Principe Orazio");
       
$book->setPublisher("Princex Books Edition");
       
$book->setDatePublished("2014-02-02", "02/02/2014");
       
$book->setEdition("2014 Edition");
       
$book->setISBN("1234567890123");
       
$book->setAvailableEbook(true);
       
$book->setAvailableHardcover(true);
       
$book->setAvailablePaperback(true);
       
       
$book->setRatingValue(4);
       
$book->setReviewsCount(8);
       
$book->setPrice("100 €");
       
$book->setCondition(\Microdata\iMicrodata::CONDITION_NEW, "new");

        echo
$book->getCompleteCode();
       
?>

        <hr />
        Example using single terms
        <?=$book->openSchemaCode()?>
<?=$book->getUrlCode()?>
<?=$book->getDescriptionCode()?>
<?=$book->getAuthorCode("Written by: ")?>
<?=$book->getPublisherCode("Published by: ")?>
<?=$book->getDatePublishedCode("Published by:")?>
<?=$book->getEditionCode()?>
<?=$book->getISBNCode()?>
<div>
                Available in:
                <div><?=($book->getAvailableEbookCode("Ebook"))?></div>
                <div><?=($book->getAvailablePaperbackCode("Paperback"))?></div>
                <div><?=($book->getAvailableHardcoverCode("Hardcover"))?></div>
            </div>
        <?=$book->closeSchemaCode()?>



    </body>
</html>