SparseThisPage([$username,
[$password, [$host]]])
exit()
when it
finishes, so make sure to do any further processing before
you call it. You can do more processing in a separate PHP tag if you
wish, though; only the current PHP tag will be ignored after
SparseThisPage is called.
SparseThisPage($connection)
SparsePage($page,
[$username, [$password, [$host]]])
SparsePage($page,
$connection)
<!-- first part of template goes here,
including sqltemplate and sqlrow tags -->
<?php if (isset($_COOKIE['username'])) { ?>
<td><sqlfield name="password" /></td>
<?php } ?>
$this->current_row
: The current row in the data
being displayed. You can e.g. use this to alternate colors for odd and
even rows.$this->data
: The full dataset that was returned
from the query, consisting of a 2D array (indexed 0 to total rows) $template->page
: The current page the user is
viewing (starting from zero).$template->totalRows
: The total rows in the query
- i.e. NOT just the ones displayed on this page, but all of them
together. You can get the total rows displayed on this page by
accessing count($this->data)
.$template->message
: The general message
calculated to print out to the user. See sqlmessage.$template->row_errors
: An array of errors (one
per row) which would be printed out in an sqlrowerror.SparseThisPage()
as your function call
(allowing you to put all your Sparse and PHP code in a single page),
the first PHP tag (from <?php to ?>) on the page is unique. The
following things are true
about it:SparseThisPage()
will be ignored, because SparseThisPage()
calls exit()
.
You can either put the code in a separate
PHP tag, or before the SparseThisPage()
call (e.g. if it
needs to be done before
the data is updated).SparseThisPage()
,
though, because it may try to set cookies when it launches, which it
does via headers. In other words, if you have stuff to do on the page
before the default behavior of Sparse happens, you'll have to do all
the logic before the call, but all the output in a separate PHP tag.SparseThisPage()
.
Functions declared in
subsequent tags will give you a warning that you're trying to declare
them twice (because they're declared once when the page is loaded and
again when the PHP code is actually executed). Note that if you
include a separate file with your functions, you can stick the
include statement wherever you
like and can bypass this problem entirely.SparseThisPage()
.Previous: Configuring Sparse | PHP Reference | Next: Ajax