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


PHP SmartyPaginate::getCurrentIndex方法代码示例

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


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

示例1: get_db_results

function get_db_results()
{
    // normally you would have an SQL query here,
    // for this example we fabricate a 100 item array
    // (emulating a table with 100 records)
    // and slice out our pagination range
    // (emulating a LIMIT X,Y MySQL clause)
    $_data = range(1, 100);
    SmartyPaginate::setTotal(count($_data));
    return array_slice($_data, SmartyPaginate::getCurrentIndex(), SmartyPaginate::getLimit());
}
开发者ID:ratnesh2011,项目名称:roz,代码行数:11,代码来源:index.php

示例2: getSearchResults

function getSearchResults(&$dbcon, $searchSpec)
{
    $X = SmartyPaginate::getCurrentIndex();
    $Y = SmartyPaginate::getLimit();
    $searchSQL = "SELECT * FROM sionapros_news WHERE 1 {$searchSpec} ORDER BY pub_date DESC LIMIT {$X},{$Y}";
    $result = $dbcon->execute($searchSQL);
    foreach ($result as $row) {
        $data[] = $row;
    }
    // now we get the total number of records from the table
    $rowsSQL = "SELECT COUNT(*) FROM sionapros_news WHERE 1 {$searchSpec}";
    $dbcon->query($rowsSQL);
    SmartyPaginate::setTotal($dbcon->getValue());
    return $data;
}
开发者ID:jsan4christ,项目名称:idrc-uganda-site,代码行数:15,代码来源:news-and-events.inc.php

示例3: getSearchResults

function getSearchResults(&$dbcon)
{
    $X = SmartyPaginate::getCurrentIndex();
    $Y = SmartyPaginate::getLimit();
    $searchSQL = "SELECT * FROM sionapros_news WHERE 1 ORDER BY news_no DESC LIMIT {$X},{$Y}";
    $result = $dbcon->execute($searchSQL);
    foreach ($result as $row) {
        // collect each record into $_data
        $data[] = $row;
    }
    // now we get the total number of records from the table
    $rowsSQL = "SELECT COUNT(*) FROM sionapros_news WHERE 1";
    $dbcon->query($rowsSQL);
    #$rowNo = $rows[0];
    SmartyPaginate::setTotal($dbcon->getValue());
    $dbcon->free();
    return $data;
}
开发者ID:jsan4christ,项目名称:idrc-uganda-site,代码行数:18,代码来源:tm0.news.display_news.php

示例4: getSearchResults

function getSearchResults(&$dbcon, $proj_no)
{
    $X = SmartyPaginate::getCurrentIndex();
    $Y = SmartyPaginate::getLimit();
    $searchSQL = "SELECT p.*,c.value FROM sionapros_pubs AS p INNER JOIN sionapros_categories AS c";
    $searchSQL .= " ON p.category = c.id WHERE 1 {$_SESSION['search']} ORDER BY id DESC LIMIT {$X},{$Y}";
    $result = $dbcon->execute($searchSQL);
    foreach ($result as $row) {
        // collect each record into $_data
        $data[] = $row;
    }
    // now we get the total number of records from the table
    $rowsSQL = "SELECT COUNT(*) FROM sionapros_pubs AS p WHERE 1 {$_SESSION['search']}";
    $dbcon->query($rowsSQL);
    #$rowNo = $rows[0];
    SmartyPaginate::setTotal($dbcon->getValue());
    $dbcon->free();
    return $data;
}
开发者ID:jsan4christ,项目名称:idrc-uganda-site,代码行数:19,代码来源:pubs.show_pubs.php

示例5: getSearchResults

function getSearchResults(&$dbcon)
{
    $X = SmartyPaginate::getCurrentIndex();
    $Y = SmartyPaginate::getLimit();
    $searchSQL = "SELECT firstname,lastname,identifier FROM sionapros_users";
    $searchSQL .= " WHERE 1 {$_SESSION['search']} ORDER BY identifier ASC LIMIT {$X},{$Y}";
    $result = $dbcon->execute($searchSQL);
    foreach ($result as $row) {
        // collect each record into $_data
        $data[] = $row;
    }
    // now we get the total number of records from the table
    $rowsSQL = "SELECT COUNT(*) FROM sionapros_users WHERE 1 {$_SESSION['search']}";
    $dbcon->query($rowsSQL);
    #$rowNo = $rows[0];
    SmartyPaginate::setTotal($dbcon->getValue());
    $dbcon->free();
    return $data;
}
开发者ID:jsan4christ,项目名称:idrc-uganda-site,代码行数:19,代码来源:user.show_user.php

示例6: getSearchResults

function getSearchResults(&$dbcon)
{
    $X = SmartyPaginate::getCurrentIndex();
    $Y = SmartyPaginate::getLimit();
    $searchSQL = "SELECT fq.*,C.value FROM sionapros_faqs AS fq INNER JOIN sionapros_categories";
    $searchSQL .= " AS C ON fq.category = C.id ORDER BY C.id,fq.id LIMIT {$X},{$Y}";
    $result = $dbcon->execute($searchSQL);
    echo $dbcon->error;
    foreach ($result as $row) {
        // collect each record into $_data
        $data[] = $row;
    }
    // now we get the total number of records from the table
    $rowsSQL = "SELECT COUNT(*) FROM sionapros_faqs WHERE 1";
    $dbcon->query($rowsSQL);
    #$rowNo = $rows[0];
    SmartyPaginate::setTotal($dbcon->getValue());
    $dbcon->free();
    return $data;
}
开发者ID:jsan4christ,项目名称:idrc-uganda-site,代码行数:20,代码来源:faqs.show_faqs.php

示例7: getSearchResults

function getSearchResults(&$dbcon)
{
    #$searchSQL = sprintf("SELECT * FROM ehmis_personnel_main WHERE 1 {$_SESSION['search']} ORDER BY identifier ASC LIMIT %d,%d",
    #    					SmartyPaginate::getCurrentIndex(), SmartyPaginate::getLimit());
    $X = SmartyPaginate::getCurrentIndex();
    $Y = SmartyPaginate::getLimit();
    $searchSQL = "SELECT n.*,c.value FROM sionapros_news AS n INNER JOIN sionapros_categories AS c ON";
    $searchSQL .= " n.category = c.id WHERE 1 {$_SESSION['search']} ORDER BY n.news_no DESC LIMIT {$X},{$Y}";
    $result = $dbcon->execute($searchSQL);
    foreach ($result as $row) {
        // collect each record into $_data
        $data[] = $row;
    }
    // now we get the total number of records from the table
    $rowsSQL = "SELECT COUNT(*) FROM sionapros_news AS n WHERE 1 {$_SESSION['search']}";
    $dbcon->query($rowsSQL);
    #$rowNo = $rows[0];
    SmartyPaginate::setTotal($dbcon->getValue());
    $dbcon->free();
    return $data;
}
开发者ID:jsan4christ,项目名称:idrc-uganda-site,代码行数:21,代码来源:tm0.news.show_news.php

示例8: getProjectLog

 function getProjectLog($project, $lim = 10)
 {
     $project = (int) $project;
     $lim = (int) $lim;
     $sel = mysql_query("SELECT COUNT(*) FROM log WHERE project = {$project} ");
     $num = mysql_fetch_row($sel);
     $num = $num[0];
     if ($num > 200) {
         $num = 200;
     }
     SmartyPaginate::connect();
     // set items per page
     SmartyPaginate::setLimit($lim);
     SmartyPaginate::setTotal($num);
     $start = SmartyPaginate::getCurrentIndex();
     $lim = SmartyPaginate::getLimit();
     $sql = "SELECT * FROM log WHERE project = {$project} ORDER BY ID DESC LIMIT {$start},{$lim}";
     $sel2 = mysql_query($sql);
     $mylog = array();
     while ($log = mysql_fetch_array($sel2)) {
         if (!empty($log)) {
             $sel3 = mysql_query("SELECT name FROM projekte WHERE ID = {$log['project']}");
             $proname = mysql_fetch_array($sel3);
             $proname = $proname[0];
             $log["proname"] = $proname;
             $log["proname"] = stripslashes($log["proname"]);
             $log["username"] = stripslashes($log["username"]);
             $log["name"] = stripslashes($log["name"]);
             array_push($mylog, $log);
         }
     }
     if (!empty($mylog)) {
         return $mylog;
     } else {
         return false;
     }
 }
开发者ID:janvalentik,项目名称:Collabtive,代码行数:37,代码来源:class.mylog.php

示例9: getSearchResults

function getSearchResults(&$dbcon, $searchSpec)
{
    $X = SmartyPaginate::getCurrentIndex();
    $Y = SmartyPaginate::getLimit();
    $searchSQL = "SELECT * FROM sionapros_pubs WHERE 1 {$searchSpec} ORDER BY pub_date DESC LIMIT {$X},{$Y}";
    $result = $dbcon->execute($searchSQL);
    $i = 0;
    foreach ($result as $row) {
        #$path = './admin'.substr($row['doc'], 1, strlen($row['doc']));
        $data[$i] = $row;
        #$data[$i]['path'] = $path;
        $i++;
    }
    // now we get the total number of records from the table
    $rowsSQL = "SELECT COUNT(*) FROM sionapros_pubs WHERE 1 {$searchSpec}";
    $dbcon->query($rowsSQL);
    #$rowNo = $rows[0];
    SmartyPaginate::setTotal($dbcon->getValue());
    return $data;
}
开发者ID:jsan4christ,项目名称:idrc-uganda-site,代码行数:20,代码来源:publications.inc.php

示例10: getProjectMembers

 /**
  * Lists all the users in a project
  *
  * @param int $project Eindeutige Projektnummer
  * @param int $lim Maximum auszugebender Mitglieder
  * @return array $members Projektmitglieder
  */
 function getProjectMembers($project, $lim = 10, $paginate = true)
 {
     global $conn;
     $project = (int) $project;
     $lim = (int) $lim;
     $project = (int) $project;
     $lim = (int) $lim;
     $members = array();
     if ($paginate) {
         $num = $conn->query("SELECT COUNT(*) FROM projekte_assigned WHERE projekt = {$project}")->fetch();
         $num = $num[0];
         $lim = (int) $lim;
         SmartyPaginate::connect();
         // set items per page
         SmartyPaginate::setLimit($lim);
         SmartyPaginate::setTotal($num);
         $start = SmartyPaginate::getCurrentIndex();
         $lim = SmartyPaginate::getLimit();
     } else {
         $start = 0;
     }
     $sel1 = $conn->query("SELECT user FROM projekte_assigned WHERE projekt = {$project} LIMIT {$start},{$lim}");
     $usr = new user();
     while ($user = $sel1->fetch()) {
         $theuser = $usr->getProfile($user[0]);
         array_push($members, $theuser);
     }
     if (!empty($members)) {
         return $members;
     } else {
         return false;
     }
 }
开发者ID:Setrino,项目名称:collabtive,代码行数:40,代码来源:class.project.php

示例11: mysql_query

        /*	$tips = R::getAll(sprintf("select SQL_NO_CACHE SQL_CALC_FOUND_ROWS *, t.id as tid from tip t join category c on t.category_id = c.id where t.category_id = '".$c."' order by t.schedule_time LIMIT %d,%d",
           SmartyPaginate::getCurrentIndex(), SmartyPaginate::getLimit())); */
    }
    $_query = "select *, t.id as tid from tip t join category c on t.category_id = c.id where t.category_id = '" . $c . "' and t.schedule_time between {$start} and {$end}";
    /*$tips = R::getAll(sprintf("select SQL_NO_CACHE SQL_CALC_FOUND_ROWS *, t.id as tid from tip t join category c on t.category_id = c.id where t.category_id = '".$c."' and t.schedule_time between $start and $end LIMIT %d,%d",
      SmartyPaginate::getCurrentIndex(), SmartyPaginate::getLimit())); */
} else {
    $_query = "select *, t.id as tid from tip t join category c where c.id = t.category_id order by t.schedule_time desc";
    /*$tips = R::getAll(sprintf("select SQL_NO_CACHE SQL_CALC_FOUND_ROWS *, t.id as tid from tip t join category c where c.id = t.category_id order by t.schedule_time desc LIMIT %d,%d",
      SmartyPaginate::getCurrentIndex(), SmartyPaginate::getLimit())); */
}
$_SESSION['query'] = $_query;
$cherche = mysql_query($_SESSION['query'], $link);
while ($line = mysql_fetch_array($cherche, MYSQL_ASSOC)) {
    $tips[] = $line;
    //var_dump($tips); exit;
}
$_SESSION['count'] = mysql_num_rows(mysql_query($_SESSION['query']));
$view = $top;
$smarty->assign('title', 'mHealth::Living Healthy goes mobile');
$smarty->assign('topic', 'Manage Tips');
$smarty->assign('view', $view);
$smarty->assign('info', $info);
$smarty->assign('categorys', $categorys);
$start = SmartyPaginate::getCurrentIndex();
$limit = SmartyPaginate::getLimit();
$smarty->assign('tips', array_slice($tips, $start, $limit));
SmartyPaginate::setTotal($_SESSION['count']);
SmartyPaginate::assign($smarty);
$smarty->display('tips_user.tpl');
SmartyPaginate::reset();
开发者ID:hiroyalty,项目名称:mhealth,代码行数:31,代码来源:manage.php

示例12: getProjectLog

 function getProjectLog($project, $lim = 25)
 {
     global $conn;
     $project = (int) $project;
     $lim = (int) $lim;
     $sel = $conn->prepare("SELECT COUNT(*) FROM log WHERE project = ? ");
     $sel->execute(array($project));
     $num = $sel->fetch();
     $num = $num[0];
     if ($num > 200) {
         $num = 200;
     }
     SmartyPaginate::connect();
     // set items per page
     SmartyPaginate::setLimit($lim);
     SmartyPaginate::setTotal($num);
     $start = SmartyPaginate::getCurrentIndex();
     $lim = SmartyPaginate::getLimit();
     $sql = "SELECT * FROM log WHERE project = ? ORDER BY ID DESC LIMIT {$start},{$lim}";
     $sel2 = $conn->prepare($sql);
     $sel2->execute(array($project));
     $mylog = array();
     while ($log = $sel2->fetch()) {
         if (!empty($log)) {
             $sel3 = $conn->query("SELECT name FROM projekte WHERE ID = {$log['project']}");
             $proname = $sel3->fetch();
             $proname = $proname[0];
             $log["proname"] = $proname;
             //$log["proname"] = stripslashes($log["proname"]);
             //$log["username"] = stripslashes($log["username"]);
             $log["name"] = stripslashes($log["name"]);
             array_push($mylog, $log);
         }
     }
     if (!empty($mylog)) {
         return $mylog;
     } else {
         return false;
     }
 }
开发者ID:veganaize,项目名称:Collabtive,代码行数:40,代码来源:class.mylog.php

示例13: getProjectFiles

 /**
  * List all files associated to a given project
  *
  * @param string $id Project ID
  * @param int $lim Limit
  * @param int $folder Folder
  * @return array $files Found files
  */
 function getProjectFiles($id, $lim = 25, $folder = "")
 {
     $id = (int) $id;
     $lim = (int) $lim;
     $folder = (int) $folder;
     if ($folder > 0) {
         $fold = "files/" . CL_CONFIG . "/{$id}/{$folder}/";
         $sel = mysql_query("SELECT COUNT(*) FROM files WHERE project = {$id} AND folder = {$folder} ORDER BY ID DESC");
     } else {
         $sel = mysql_query("SELECT COUNT(*) FROM files WHERE project = {$id} AND folder = 0 ORDER BY ID DESC");
     }
     $num = mysql_fetch_row($sel);
     $num = $num[0];
     SmartyPaginate::connect();
     // set items per page
     SmartyPaginate::setLimit($lim);
     SmartyPaginate::setTotal($num);
     $start = SmartyPaginate::getCurrentIndex();
     $lim = SmartyPaginate::getLimit();
     $files = array();
     if ($folder > 0) {
         $sql = "SELECT ID FROM files WHERE project = {$id} AND folder = {$folder} ORDER BY  ID DESC LIMIT {$start},{$lim}";
         $sel2 = mysql_query($sql);
     } else {
         $sel2 = mysql_query("SELECT ID FROM files WHERE project = {$id} AND folder = 0 ORDER BY  ID DESC LIMIT {$start},{$lim}");
     }
     while ($file = mysql_fetch_array($sel2)) {
         if (!empty($file)) {
             array_push($files, $this->getFile($file["ID"]));
         }
     }
     if (!empty($files)) {
         return $files;
     } else {
         return false;
     }
 }
开发者ID:janvalentik,项目名称:Collabtive,代码行数:45,代码来源:class.datei.php

示例14: getAllUsers

 /**
  * Returns all users
  *
  * @param int $lim Limit
  * @return array $users Registrierte Mitglieder
  */
 function getAllUsers($lim = 10)
 {
     global $conn;
     $lim = (int) $lim;
     $num = $conn->query("SELECT COUNT(*) FROM `user`")->fetch();
     $num = $num[0];
     SmartyPaginate::connect();
     // set items per page
     SmartyPaginate::setLimit($lim);
     SmartyPaginate::setTotal($num);
     $start = SmartyPaginate::getCurrentIndex();
     $lim = SmartyPaginate::getLimit();
     $sel2 = $conn->query("SELECT ID FROM `user` ORDER BY ID DESC LIMIT {$start},{$lim}");
     $users = array();
     while ($user = $sel2->fetch()) {
         array_push($users, $this->getProfile($user["ID"]));
     }
     if (!empty($users)) {
         return $users;
     } else {
         return false;
     }
 }
开发者ID:Setrino,项目名称:collabtive,代码行数:29,代码来源:class.user.php

示例15: getProjectTrack

    function getProjectTrack($project, $user = 0, $task = 0, $start = 0, $end = 0, $lim = 50)
    {
        $start = mysql_real_escape_string($start);
        $end = mysql_real_escape_string($end);
        $project = (int) $project;
        $user = (int) $user;
        $lim = (int) $lim;

        if ($user > 0)
        {
            $sql = "SELECT * FROM timetracker WHERE project = $project AND user = $user";
            $num = "SELECT COUNT(*) FROM timetracker WHERE project = $project AND user = $user";
            $order = " ORDER BY ended ASC";
        }
        else
        {
            $sql = "SELECT * FROM timetracker WHERE project = $project";
            $num = "SELECT COUNT(*) FROM timetracker WHERE project = $project";
            $order = " ORDER BY ended ASC";
        }

        if ($task > 0)
        {
            $sql .= " AND task = $task";
            $num .= " AND task = $task";
        }

        if ($start > 0 and $end > 0)
        {
            $start = strtotime($start);
            $end = strtotime($end . " +1 day");
            $end = $end - 1;
            $sql .= " AND ended >=$start AND ended<=$end ";
            $num .= " AND ended >=$start AND ended<=$end ";
        }

        if ($num)
        {
            $num = mysql_fetch_row(mysql_query($num));
            $num = $num[0];
        }
        else
        {
            $num = 0;
        }

        $sql = $sql . $order;
        SmartyPaginate::connect();
        SmartyPaginate::setLimit($lim);
        SmartyPaginate::setTotal($num);

        $start = SmartyPaginate::getCurrentIndex();
        $lim = SmartyPaginate::getLimit();

        $limi = " LIMIT $start,$lim ";
        $sql = $sql . $limi;

        $sel = mysql_query($sql);

        $track = array();
        $ttask = new task();

        if (isset($sel))
        {
            while ($data = @mysql_fetch_array($sel))
            {
                $endstring = date("H:i", $data["ended"]);
                $startstring = date("H:i", $data["started"]);
                $daystring = date("d.m.y", $data["ended"]);
                $tasks = $ttask->getTask($data["task"]);

                if (!empty($tasks))
                {
                    $tasks = $tasks["title"];
                    $data["tname"] = $tasks;
                }

                $pname = mysql_query("SELECT name FROM projekte WHERE ID = $data[project]");
                $pname = mysql_fetch_row($pname);
                $pname = stripslashes($pname[0]);

                $uname = mysql_query("SELECT name FROM user WHERE ID = $data[user]");
                $uname = mysql_fetch_row($uname);
                $uname = stripslashes($uname[0]);

                $data["endstring"] = $endstring;
                $data["startstring"] = $startstring;
                $data["daystring"] = $daystring;
                $data["uname"] = $uname;
                $data["pname"] = $pname;
                $data["comment"] = stripslashes($data["comment"]);
                $data["comment"] = nl2br($data["comment"]);
                array_push($track, $data);
            }
        }

        if (!empty($track))
        {
            return $track;
        }
//.........这里部分代码省略.........
开发者ID:janvalentik,项目名称:Collabtive,代码行数:101,代码来源:class.timetracker.php


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