本文整理汇总了PHP中get_products函数的典型用法代码示例。如果您正苦于以下问题:PHP get_products函数的具体用法?PHP get_products怎么用?PHP get_products使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_products函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetProducts
public function testGetProducts()
{
$params = array('title' => 'My test post is here', 'content_type' => 'post', 'subtype' => 'product', 'is_active' => 1);
//saving
$new_page_id = save_content($params);
$get_pages = get_products($params);
$page_found = false;
if (is_array($get_pages)) {
foreach ($get_pages as $page) {
if ($page['id'] == $new_page_id) {
$page_found = true;
$this->assertEquals('post', $page['content_type']);
$this->assertEquals('product', $page['subtype']);
}
//PHPUnit
$this->assertEquals(true, intval($page['id']) > 0);
}
}
//clean
$delete_sub_page = delete_content($new_page_id);
//PHPUnit
$this->assertEquals(true, $page_found);
$this->assertEquals(true, intval($new_page_id) > 0);
$this->assertEquals(true, is_array($get_pages));
$this->assertEquals(true, is_array($delete_sub_page));
}
示例2: get_table
function get_table()
{
////////////////////////////////////////////////////////////////////////////////////////////////////
$conn = mysqli_connect("localhost", "root", "", "consimentweb_sql");
if (!$conn) {
echo "Error: ";
}
//create table
$table_str = '<table id="product_table">';
$table_str .= "<tr>";
$table_str .= '<th>Image</th><th>Name</th><th>Price</th><th>Date</th><th>Detail</th>';
$table_str .= "</tr>";
$products = get_products();
$pic = "";
$class = "article current";
$all = count($products);
$pad = ceil($all / 4);
foreach ($products as $product) {
$query = "select * from con_photo where {$product->P_ID}=con_photo.p_id limit 1";
$data = mysqli_query($conn, $query);
$pic = mysqli_fetch_array($data, MYSQLI_ASSOC);
$table_str .= "<tr>";
$table_str .= '<td width="20%" height="100px"><center><img src="images/' . $pic["PHOTO"] . '"></center></td>
<td><center>' . $product->P_NAME . '</center></td>
<td><center>' . $product->PRICE . '<center></td>
<td><center>' . $product->START_DATE . '<center></td>
<td><div style="cursor: pointer;" class="' . $class . '"><center>View detail</center></div>
<div class="pop">
<div style="position:absolute; width:50%; height:100%; left:0px; top:0px;";>
<div style="position:relative; top:25%; left:10%; border-style: solid; border-width: 1px; width:80%; height:50%;">
<img src="#" style="width:100%; height:100%;">
</div>
</div>
<div style="position:absolute; width:50%; height:100%; right:0px; top:0px;">
<div style="height:15%; width:200%; border-style:solid; border-width:1px; margin-left:-100%;">' . $product->P_ID . '
</div>
<div style="height:30%; width:100%; border-style: solid; border-width: 1px;">
<div style="margin:5%; border-style: solid; border-width:1px; word-wrap:break-word;">' . $product->P_NAME . $product->PRICE . $product->START_DATE . $pic["PHOTO"] . '</div>
</div>
<div style="height:55%; width:100%; border-style: solid; border-width: 1px;">
<div style="margin:5%; border-style: solid; border-width:1px; word-wrap:break-word;">' . $product->DETAIL . '</div>
<div style="position:absolute; bottom: 2vh;right: 2vw;"><a href="create_transaction.php?P_ID=' . $product->P_ID . '">BUY</a></div>
</div>
</div>
</div>
</td>';
$table_str .= '</tr>';
$class = "article";
}
$table_str .= '</table><div class="padding">';
for ($b = 1; $b <= $pad; $b++) {
$table_str .= '<a href="show_list_product_sql.php?page=' . $b . '" style="text-decoration:none ">' . $b . ' </a>';
}
$table_str .= '</div><div id="pop_close">X</div>';
////////////////////////////////////////////////////////////////////////////////////////////////////////
mysqli_close($conn);
///////////////////////////////////////////////////////////////////////////////////////////////////////////
return $table_str;
}
示例3: get_table
function get_table()
{
$table_str = '';
$Product = get_products();
foreach ($Product as $product) {
$table_str .= '' . $product->product_name;
}
return $table_str;
}
示例4: save_page_data
function save_page_data($page, $sort, $per_page)
{
$cache_key = build_cache_key($page, $sort);
$result = get_cache($cache_key);
if (!$result) {
$data = get_products($page, $per_page, true);
$ids = '';
foreach ($data as $product) {
$ids .= $product[0] . ',';
}
set_cache($cache_key, substr($ids, 0, -1));
}
}
示例5: get_page_data
function get_page_data()
{
if (isset($_GET['page'])) {
$page = $_GET['page'] - 1;
} else {
$page = 0;
}
$data['products'] = get_products($page, PER_PAGE);
$data['pagination']['total'] = ceil(get_count_product() / PER_PAGE);
$data['pagination']['page'] = $page + 1;
prepare_response($data);
return $data;
}
示例6: normalView
function normalView()
{
echo '<p>Click on some of the filters to alter your query.</p>';
echo '<table width="100%">
<tr>
<td style="width:20%;vertical-align:top;">';
get_questions();
echo '</td>
<td style="vertical-align:top;">';
get_products();
echo '</td>
</tr>
</table>';
}
示例7: get_table
function get_table()
{
//create table
$products = get_products();
$table_str = '<table id="t1">';
$table_str .= '<thead>';
$table_str .= '<tr>';
$table_str .= '<th>Nombre del Evento</th>';
$table_str .= '<th>Descripción</th>';
$table_str .= '<th>Lugar</th>';
$table_str .= '<th>Fecha de Inicio</th>';
$table_str .= '<th>Fecha de Final</th>';
$table_str .= '<th id="thButtons">Crear Evento</th>';
$table_str .= '<th id="thButtons"><a href="CrearEvento.php"><button class="addButton"></button></a></td>';
$table_str .= '</tr>';
$table_str .= '</thead>';
$table_str .= '<tbody>';
foreach ($products as $product) {
$table_str .= '<tr>';
$table_str .= '<td>' . $product->Nombre . '</td>';
$table_str .= '<td>' . $product->Descripcion . '</td>';
$table_str .= '<td>' . $product->Lugar . '</td>';
$table_str .= '<td>' . $product->FechaInicio . '</td>';
$table_str .= '<td>' . $product->FechaFinal . '</td>';
$table_str .= '<td id="tdButtons"><button class="editButton"></button></td>';
$table_str .= '<td id="tdButtons"><button class="deleteButton onclick="deleteFromDB()"></button></td>';
$table_str .= '</tr>';
}
$table_str .= '</tbody>';
$table_str .= '<tfoot>';
$table_str .= '<tr>';
$table_str .= '</tr>';
$table_str .= '</tfoot>';
$table_str .= '</table>';
return $table_str;
}
示例8: get_table
function get_table()
{
//create table in HTML
$table_str = '<table id=product_table>';
$products = get_products();
$i = 1;
$table_str .= '<tr class="head_table">';
$table_str .= '<th>DeviceId</th><th>TimeStamp</th><th>Action</th><th>Value</th>';
$table_str .= '</tr>';
foreach ($products as $product) {
$class = '';
if ($i % 2 == 0) {
$class = 'row_even';
} else {
$class = 'row_odd';
}
$table_str .= '<tr class="' . $class . '">';
$table_str .= '<td width=30>' . $product['My_DeviceId'] . '</td><td>' . $product['My_TimeStamp'] . '</td><td>' . $product['My_Action'] . '</td><td>' . $product['My_Value'] . '</td>';
$table_str .= '</tr>';
$i++;
}
$table_str .= '</table>';
return $table_str;
}
示例9: find_products
/**
* Looks for products using a keyword
*/
function find_products($keyword)
{
return get_products();
}
示例10: switch
<?php
//type of request
//1: get description of product
//2: delete product
//3: edit price
$cmd = $_REQUEST['cmd'];
switch ($cmd) {
case 1:
get_products($_REQUEST['id']);
break;
case 2:
delete_product($_REQUEST['id']);
break;
default:
}
function get_products($id)
{
include "products.php";
$obj = new products();
$row = $obj->get_product($id);
//return a JSON string to browser when request comes to get description
echo '{"result":1,"desc":"' . $row['description'] . '"}';
}
function delete_product($id)
{
include "products.php";
$obj = new products();
if ($obj->delete($id)) {
echo '{"result":1,"message": "deleted"}';
} else {
示例11: get_products
if (preg_match('#\\d{7}#', $match[1], $matches)) {
if (array_key_exists('0', $matches)) {
$skus[] = $matches[0];
}
}
}
}
return $skus;
}
// Include the library.
require 'scraperwiki/simple_html_dom.php';
// The base URL.
$base_url = "http://techmanual.yakima.com/";
$allowed_tags = "<br>,<strong>,<b>";
$active_skus = get_products("active");
$discontinued_skus = get_products("discontinued");
process_data($active_skus, 1);
process_data($discontinued_skus, 0);
// To process the data.
function process_data($skus, $avail = 1)
{
global $allowed_tags;
if (!empty($skus) && is_array($skus)) {
foreach ($skus as $sku) {
// Get the description.
$description = strip_tags(get_description($sku), $allowed_tags);
// Add it to an array.
$record = array('sku' => $sku, 'avail' => $avail, 'desc' => $description);
// Add it to the table.
scraperwiki::save_sqlite(array('sku'), array($record), "techmanual", 2);
}
示例12: foreach
<?php
include_once 'db.php';
if (isset($_GET['id']) && count($_POST) > 0) {
$changes = $_POST;
foreach ($changes as $key => $value) {
$changes[$key] = htmlspecialchars($value);
}
$changes['id'] = $_GET['id'];
change_product($db, $changes);
}
$items = get_products($db);
include_once 'table.php';
if (isset($_GET['id'])) {
$item = get_product($db, $_GET['id']);
include_once 'form.php';
}
示例13: get_products
<?php
$products = get_products($db);
include_once 'views/head.php';
include_once 'views/header.php';
?>
<main>
<div class="container">
<div class="banner"></div>
<div class="row clearfix">
<!-- боковое меню -->
<?php
include_once 'views/category_menu.php';
?>
<div class="column column9">
<div class="catalog">
<div class="row clearfix">
<!-- элементы каталога -->
<?php
foreach ($products as $product) {
include 'views/_product.php';
}
?>
</div>
</div>
</div>
</div>
</div>
</main>
<?php
include_once 'views/footer.php';
示例14: array
$result['gebinde_dreiviertel'] = $gebinde_dreiviertel;
$result['gebinde_liter'] = $gebinde_liter;
$results[] = $result;
$result = array();
}
if (count($results) == 0) {
$results = False;
}
$stmt->free_result();
$db->close();
return $results;
}
$results = get_products();
if ($results == False) {
$_GET['kategorie'] = "rotwein";
$results = get_products();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/default.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="description" content="Das Weinhaus Michel ist eine gemütliche Weinstube mit Gewölbekeller und Straßenterrasse mitten in der Altstadt von Mainz." />
<meta name="keywords" content="Weinhaus, Weinstube, Michel, Stefan, Weingut in Weinolsheim, Mainz, Altstadt, Weinanbau, Weinverkauf, Essen und Trinken, Warme Küche, Rheinhessische Spezialitäten, Gewölbekeller, Veranstaltungen, Gesellschaften, Straßenlokal, Terrasse, Raummiete, Weihnachtsfeier, Reservierungen, Weinbestellung, Fastnacht" />
<meta name="robots" content="index,follow" />
<meta name="language" content="de" />
<meta name="city" content="Mainz" />
<meta name="country" content="DE, Deutschland, Germany" />
<title>Weinhaus Michel – Seitentitel</title>
<link href="../style/default.css" rel="stylesheet" type="text/css" />
<link href="../favicon.ico" rel="shortcut icon" />
示例15: function
<?php
require_once 'Slim/Slim.php';
require_once 'Lite/Lite.php';
\Slim\Slim::registerAutoloader();
$app = new \Slim\Slim();
$app->get('/api/products', function () {
echo json_encode(get_products());
});
$app->get('/api/products/:pids', function ($pids) {
echo json_encode(get_products($pids));
});
$app->post('/api/sync', function () {
echo json_encode(sync_products());
});
$app->post('/api/sync/vendor/:vid', function ($vid) {
echo json_encode(sync_products($vid, NULL));
});
$app->post('/api/sync/channel/:cid', function ($cid) {
echo json_encode(sync_products(NULL, $cid));
});
$app->post('/api/sync/vendor/:vid/channel/:cid', function ($vid, $cid) {
echo json_encode(sync_products($vid, $cid));
});
$app->run();