当前位置: 首页>>代码示例>>PHP>>正文


PHP Utilities::buildParagraph方法代码示例

本文整理汇总了PHP中Utilities::buildParagraph方法的典型用法代码示例。如果您正苦于以下问题:PHP Utilities::buildParagraph方法的具体用法?PHP Utilities::buildParagraph怎么用?PHP Utilities::buildParagraph使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Utilities的用法示例。


在下文中一共展示了Utilities::buildParagraph方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: render

 public function render()
 {
     // Here comes the rendering process
     $htmlContent = "";
     //Main Content
     //id und class Bezeichnungen der HTML Elementen
     $idContent = "content";
     $classProduct = "product-detail";
     $classImage = "img-preview-detail";
     $classDescription = "description";
     $classDescriptionText = "description-text-detail";
     $label1 = "label1";
     //local config
     $maxDescriptionCharlenght = 20000;
     $imagePath = "/src/theme/images/";
     $lang_pageTitel = i("Productview");
     $button1 = "Buy";
     //Product array
     $products = array();
     //TSCM TODO get from DB instead from Session..
     $products = $_SESSION['products'];
     //Array erstellen
     //TODO Array aus DB holen und verifizieren
     foreach ($products as $book) {
         // exit;
         if ($_GET['id'] != $book['ISBN Number']) {
             continue;
         }
         $paragraph = Utilities::buildParagraph($book);
         //too long text?
         if (strlen($book['Description']) > $maxDescriptionCharlenght) {
             $book['Description'] = substr($book['Description'], 0, $maxDescriptionCharlenght);
             $book['Description'] = $book['Description'] . "...";
         } else {
             //not too long, display it all
             $modDescription = $book['Description'];
         }
         /*
          * schwf5: Element in Warenkorb legen 
          */
         //Auslesen der BuchID
         if (isset($_GET["id"])) {
             $currentID = $_GET["id"];
         } else {
             $currentID = 0;
         }
         //Prüfen ob Seite mit added action geladen wurde (d.h. dass Buch in Korb gelegt wurde)
         if (isset($_GET["action"]) && $_GET["action"] == "added") {
             $amount = $_POST["amountSelection"];
             //Seite wurde neu geladen. Prüfen, ob bereits ein Warenkorb existiert
             //Korb existiert schon. Items also in den Warenkorb hinzufügen
             if (isset($_COOKIE["shoppingCart"])) {
                 $cartArray = json_decode($_COOKIE["shoppingCart"]);
                 array_push($cartArray, array("ID" => $currentID, "amount" => $amount));
                 setcookie("shoppingCart", json_encode($cartArray));
             } else {
                 $cartArray = array(array("ID" => $currentID, "amount" => $amount));
                 setcookie("shoppingCart", json_encode($cartArray));
             }
             //
         } else {
         }
         $htmlContent .= "\n        <div class=\"{$classProduct}\">\n        <div class=\"{$classImage}\"><img  src=\"" . $imagePath . $book['Picture'] . "\"  />\n          </div>\n          <div class=\"{$classDescription}\">\n\n           {$paragraph}\n\n              <div>\n                <a href='index.php?view=payment&id={$_GET["id"]}'>\n                  <input class='buy_button' type='button' value='" . $button1 . "'></input>\n                </a>\n                    \n                  <br>Amount: \n                  <form action='index.php?view=productdetail&id={$currentID}&action=added' method='post'>\n                  <select name='amountSelection'>\n\t\t\t\t\n  \t\t\t\t\t <option value='1'>1</option>\n \t\t\t\t\t <option value='2'>2</option>\n \t\t\t\t\t <option value='3'>3</option>\n \t\t\t\t\t <option value='4'>4</option>\n \t\t\t\t\t <option value='5'>5</option>\n \t\t\t\t\t \n\t\t\t\t\t</select>\n\t\t\t\t\t<input type='submit' name='submit' value='Add to Cart' />\n\t\t\t\t\t</form>\n  \t\t\n  \t\t\n           \t\t\n              </div>\n        \n           </div>\n        </div>";
     }
     if (isset($_GET["action"])) {
         $buyState = "Produkt wurde in den Warenkorb gelegt.<br>";
     } else {
         $buyState = "";
     }
     $htmlContentBody = "\n\t\t<div id=\"content\">\n        <span style='color:red'>{$buyState}</span>\n \n          <h1>{$lang_pageTitel}</h1>\n           {$htmlContent}\n        </div>\n        \n";
     return $htmlContentBody;
 }
开发者ID:Makae,项目名称:ch.bfh.bti7054.w2014.q.groot,代码行数:72,代码来源:view.productdetail.php

示例2: render

 public function render()
 {
     // Here comes the rendering process
     $htmlContent = "";
     //Main Content
     //id und class Bezeichnungen der HTML Elementen
     $idContent = "content";
     $classProduct = "product-detail";
     $classImage = "img-preview-detail";
     $classDescription = "description";
     $classDescriptionText = "description-text-detail";
     $label1 = "label1";
     //local config
     $maxDescriptionCharlenght = 20000;
     $imagePath = "/src/theme/images/";
     $lang_pageTitel = i("Productview");
     $button1 = "Buy";
     //Product array
     $products = array();
     //TSCM TODO get from DB instead from Session..
     $products = $_SESSION['products'];
     /*
         $products[] = array('Title' => "Medizinal Studie",
           'ISBN Number' => "142123", 
           'Author' => "Messing Hellbert", 
           'Year of publication' => 2001,
            'Price' => 29.95,
            'Currency' => 'CHF',
            'Available' => 'Sofort',
            'Language' => 'Deutsch',
            'Picture' => 'test_medizin.jpg',
           'Description' => 'Ein aussergewöhnlich gutes Buch, da vergeht die Zeit wie im Fluge. Man kann fast nicht so schnell lesen als dass man mitschreiben könnte. "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
     
     Section 1.10.32 of "de Finibus Bonorum et Malorum", written by Cicero in 45 BC
     
     "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accuEinfach fantastisch, 2 von 7 Sterne. Oder noch mehr Zeichen als dass ich die darstellen könnte. ENDE',
     'Original language' => 'DE',
     'Number of Pages' => '245',
     'Version' => '1',
     'Type' => 'Taschenbuch',
     'Genre' => 'Krimi',
     );
     */
     //Array erstellen
     //TODO Array aus DB holen und verifizieren
     foreach ($products as $book) {
         // var_dump($book);
         // exit;
         if ($_GET['id'] != $book['ISBN Number']) {
             continue;
         }
         $paragraph = Utilities::buildParagraph($book);
         //too long text?
         if (strlen($book['Description']) > $maxDescriptionCharlenght) {
             $book['Description'] = substr($book['Description'], 0, $maxDescriptionCharlenght);
             $book['Description'] = $book['Description'] . "...";
         } else {
             //not too long, display it all
             $modDescription = $book['Description'];
         }
         /*
               $htmlContent .= "
                 <div class=\"$classProduct\">
                   <div class=\"$classImage\"><img  src=\"".$imagePath.$book['Bild']."\"  />
                   </div>
                   <div class=\"$classDescription\">
                    <p><div class=\"$label1\">$lang_title</div>{$book['Titel']}</p>
                    <p><div class=\"$label1\">$lang_author</div>{$book['Autor']}</p>
                    <div class=\"$classDescriptionText\"><div class=\"$label1\">$lang_description</div>$modDescription</div>
                    <p><div class=\"$label1\">$lang_price</div> {$book['Waehrung']} {$book['Preis']}</p>
                    <p><div class=\"$label1\">$lang_available</div>{$book['Lieferbar']}</p>
         
         
                    <p><div class=\"$label1\">$lang_available</div>{$book['Lieferbar']}</p>
                    <p><div class=\"$label1\">$lang_available</div>{$book['Lieferbar']}</p>
                    <p><div class=\"$label1\">$lang_available</div>{$book['Lieferbar']}</p>
                   </div>
                 </div>";
         */
         $htmlContent .= "\n        <div class=\"{$classProduct}\">\n        <div class=\"{$classImage}\"><img  src=\"" . $imagePath . $book['Picture'] . "\"  />\n          </div>\n          <div class=\"{$classDescription}\">\n\n           {$paragraph}\n         \n\n              <div>\n                <a href='index.php?view=payment&id={$_GET["id"]}'>\n                  <input class='buy_button' type='button' value='" . $button1 . "'></input>\n                </a>\n              </div>\n           </div>\n        </div>";
     }
     //print_r($htmlContent);
     $htmlContentBody = "\n        <div id=\"content\">\n          <h1>{$lang_pageTitel}</h1>\n           {$htmlContent}\n\n\n        </div>\n        \n";
     return $htmlContentBody;
 }
开发者ID:Makae,项目名称:ch.bfh.bti7054.w2014.q.groot,代码行数:85,代码来源:view.productdetail.php

示例3: render

 public function render()
 {
     // Here comes the rendering process
     $htmlContent = "";
     //Main Content
     //id und class Bezeichnungen der HTML Elementen
     $idContent = "content";
     $classProduct = "product-detail";
     $classImage = "img-preview-detail";
     $classDescription = "description";
     $classDescriptionText = "description-text-detail";
     $label1 = "label1";
     //local config
     $maxDescriptionCharlenght = 20000;
     $imagePath = "/src/theme/images/";
     $lang_pageTitel = i("Productview");
     $button1 = i("Buy");
     //Product array
     $products = array();
     //get the product list
     $products = BookModel::findList(null, null);
     //save id
     if (isset($_GET['id'])) {
         $_SESSION['productdetail_id_selected'] = $_GET['id'];
     }
     //create an arraylist
     foreach ($products as $book) {
         if ($_SESSION['productdetail_id_selected'] != $book['isbn']) {
             continue;
         }
         $paragraph = Utilities::buildParagraph($book);
         //too long text?
         if (strlen($book['description']) > $maxDescriptionCharlenght) {
             $book['description'] = substr($book['description'], 0, $maxDescriptionCharlenght);
             $book['description'] = $book['description'] . "...";
         } else {
             //not too long, display it all
             $modDescription = $book['description'];
         }
         /*
          * schwf5: Element in Warenkorb legen
          */
         $note = "";
         $found = false;
         //Auslesen der BuchID
         if (isset($_GET["id"])) {
             $currentID = $_GET["id"];
         } else {
             $currentID = 0;
         }
         //Prüfen ob Seite mit added action geladen wurde (d.h. dass Buch in Korb gelegt wurde)
         if (isset($_GET["action"]) && $_GET["action"] == "added") {
             $amount = $_POST["amountSelection"];
             //Seite wurde neu geladen. Prüfen, ob bereits ein Warenkorb existiert
             //Korb existiert schon. Items also in den Warenkorb hinzufügen
             if (isset($_COOKIE["shoppingCart"])) {
                 //Prüfen, ob dieser Artikel schon hinzugefügt wurde. Wenn ja, den Amount hinzutun
                 $cartArray = json_decode($_COOKIE["shoppingCart"]);
                 foreach ($cartArray as $index) {
                     if ($index->ID == $currentID) {
                         $note = "Buch war schon im Korb - Anzahl aktualisiert";
                         $index->amount += $amount;
                         setcookie("shoppingCart", json_encode($cartArray));
                         $found = true;
                     }
                 }
                 if (!$found) {
                     array_push($cartArray, array("ID" => $currentID, "amount" => $amount));
                     setcookie("shoppingCart", json_encode($cartArray));
                 }
             } else {
                 $cartArray = array(array("ID" => $currentID, "amount" => $amount));
                 setcookie("shoppingCart", json_encode($cartArray));
             }
             //
         } else {
         }
         $htmlContent .= "\n        <div class=\"{$classProduct}\">\n        <div class=\"{$classImage}\"><img  src=\"" . $book['cover'] . "\"  />\n          </div>\n          <div class=\"{$classDescription}\">\n\n           {$paragraph}\n\n              <div>\n                  <br>" . i('Amount') . ":\n                  <form action='index.php?view=productdetail&id={$currentID}&action=added' method='post'>\n                  <select name='amountSelection' class='input-border'>\n\n  \t\t\t\t\t <option value='1'>1</option>\n \t\t\t\t\t <option value='2'>2</option>\n \t\t\t\t\t <option value='3'>3</option>\n \t\t\t\t\t <option value='4'>4</option>\n \t\t\t\t\t <option value='5'>5</option>\n\n\t\t\t\t\t</select>\n\t\t\t\t\t<input class='button button-primary' type='submit' name='submit' value='" . i('Add to cart') . "' />\n\t\t\t\t\t</form>\n\n\n\n              </div>\n\n           </div>\n        </div>";
     }
     //textmessage, after a product was placed in shoppingcart
     if (isset($_GET["action"])) {
         $buyState = "Produkt wurde in den Warenkorb gelegt.<br>";
     } else {
         $buyState = "";
     }
     //display page
     $htmlContentBody = "\n\t\t<div id=\"content\">\n        <span style='color:red'>{$buyState}</span>\n \t\t{$note}\n          <h1>" . $lang_pageTitel . "</h1>\n           {$htmlContent}\n        </div>\n\n";
     return $htmlContentBody;
 }
开发者ID:Makae,项目名称:ch.bfh.bti7054.w2014.q.groot,代码行数:89,代码来源:view.productdetail.php


注:本文中的Utilities::buildParagraph方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。