本文整理汇总了PHP中Read::setTable方法的典型用法代码示例。如果您正苦于以下问题:PHP Read::setTable方法的具体用法?PHP Read::setTable怎么用?PHP Read::setTable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Read
的用法示例。
在下文中一共展示了Read::setTable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Read
<?php
//Objeto READ
$read = new Read();
//VISITAS DO SITE
$read->FullRead(null, "SELECT SUM(siteviews_views) AS views FROM ws_siteviews");
$Views = $read->getResult()[0]->views;
//USUÁRIOS
$read->FullRead(null, "SELECT SUM(siteviews_users) AS users FROM ws_siteviews");
$Users = $read->getResult()[0]->users;
//MÉDIA DE PAGEVIEWS
$read->FullRead(null, "SELECT SUM(siteviews_pages) AS pages FROM ws_siteviews");
$ResPages = $read->getResult()[0]->pages;
$Pages = substr($ResPages / ($Users == 0 ? 1 : $Users), 0, 5);
//POSTS
$read->setTable("ws_posts");
$read->findAll();
$Posts = $read->getRowCount();
//EMPRESAS
$read->setTable("app_empresas");
$read->findAll();
$Empresas = $read->getRowCount();
?>
<ul>
<li class="view"><span><?php
echo $Views;
?>
</span> visitas</li>
<li class="user"><span><?php
echo $Users;
示例2: Read
</li>
<?php
}
?>
</ul>
<div class="clear"></div>
</section>
<?php
}
?>
</div>
<!--RELACIONADOS-->
<?php
$readMode = new Read();
$readMode->setTable("ws_posts");
$readMode->Query("WHERE post_status = 1 AND post_id != :post_id AND #post_category# ORDER BY rand() LIMIT 2", "post_id={$post_id}&post_category={$post_category}");
if ($readMode->getResult()) {
$View = new View();
$tpl_m = $View->Load('article_m');
?>
<footer>
<nav>
<h3>Veja também:</h3>
<?php
foreach ($readMode->getResult() as $more) {
$more->datetime = date('Y-m-d', strtotime($more->post_date));
$more->pubdate = date('d/m/Y H:i', strtotime($more->post_date));
$more->post_content = Check::Words($more->post_content, 20);
$View->Show((array) $more, $tpl_m);
}
示例3: View
$View = new View();
$tpl_g = $View->Load('article_g');
$tpl_m = $View->Load('article_m');
$tpl_p = $View->Load('article_p');
$tpl_empresa = $View->Load('empresa_p');
?>
<!--HOME SLIDER-->
<section class="main-slider">
<h3>Últimas Atualizações:</h3>
<div class="container">
<div class="slidecount">
<?php
$cat = Check::CatByName('noticias');
$post = new Read();
$post->setTable('ws_posts');
$post->Query("WHERE post_status = 1 AND (post_cat_parent = :cat OR post_category = :cat) ORDER BY post_date DESC LIMIT :limit OFFSET :offset", "cat={$cat}&limit=3&offset=0");
if (!$post->getResult()) {
WSErro('Desculpe, ainda não existem notícias cadastradas. Favor volte mais tarde!', WS_INFOR);
} else {
foreach ($post->getResult() as $slide) {
$slide->post_title = Check::Words($slide->post_title, 12);
$slide->post_content = Check::Words($slide->post_content, 38);
$slide->datetime = date('Y-m-d', strtotime($slide->post_date));
$slide->pubdate = date('d/m/Y H:i', strtotime($slide->post_date));
$View->Show((array) $slide, $tpl_g);
}
}
?>
</div>
示例4: foreach
<article class="ads">
<header>
<h1>Anúncio Patrocinado:</h1>
<a href="http://www.upinside.com.br/campus" title="Campus UpInside - Treinamentos em TI 100% em Vídeo aulas">
<img src="<?php
echo INCLUDE_PATH;
?>
/_tmp/banner_large.png" alt="UPINSIDE TEINAMENTOS" title="UPINSIDE TEINAMENTOS" />
</a>
</header>
</article>
<section class="widget art-list last-publish">
<h2 class="line_title"><span class="oliva">Últimas Atualizações:</span></h2>
<?php
$side->setTable('ws_posts');
$side->Query("WHERE post_status = 1 AND post_id != :side ORDER BY post_date DESC LIMIT 3", "side={$post_id}");
if ($side->getResult()) {
foreach ($side->getResult() as $last) {
$last->datetime = date('Y-m-d', strtotime($last->post_date));
$last->pubdate = date('d/m/Y H:i', strtotime($last->post_date));
$View->Show((array) $last, $tpl_p);
}
}
?>
</section>
<section class="widget art-list most-view">
<h2 class="line_title"><span class="vermelho">Destaques:</span></h2>
<?php
$side->setTable('ws_posts');