當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。