loopDbChunk 2.2.1-alpha0

loopDbChunk 2.2.1-alpha0

Released Mar 15, 2011 by elastic

It,s like snippet loopDbChunk for the EVO, but only for the REVO. The snippet will loop over a database table and for each row will inject all fields into placeholders contained in a chunk.

Download 26kb (1019 downloads)
Downloads: 1,238
License: GPLv2
Requires Revolution 2.0.x or greater
Supports mysql

It,s like snippet loopDbChunk for the EVO, but only for the REVO. The
snippet will loop over a database table and for each row will inject all
fields into placeholders contained in a chunk.

Installation Instructions

&dbConnect - (Opt)Boolean. If true, will connect to foreign db, uses config.inc.php under core/components/package/config/&package - The name of the folder that contains the xPDO model package.&model - The path to the xPDO model package folder, relative to the core folder.If you use a snippet to work with MODX core tables, you do not need to specify parameters &package and &model.&class - The xPDO model class  that represents a specific table.&alias - (Opt)Sets a SQL alias for the table.&select - (Opt)commaseperated list of table columns. If not specified, all columns are selected.&where - (Opt) A JSON expression of criteria to build any additional where clauses from. An example would be&where=`{{"alias:LIKE":"foo%", "OR:alias:LIKE":"%bar"},{"OR:pagetitle:=":"foobar", "AND:description:=":"raboof"}}`.&sortby - (Opt)Field to sort by.&sortdir - (Opt)Order which to sort by.&orderby - (Opt) Sorting by multiple fields. For example &orderby = `parent ASC, id DESC`&limit - Limits the number of rows returned.&offset - An offset of rows returned by the criteria to skip.&ids - (Opt)commaseperated list of ids.&idField - (Opt)fieldname for idField if other than 'id'.&outerTpl - (Opt)wrapper template with placeholder for items.&tpl - Row template. [NOTE: if not provided, properties are dumped to output for each row]&tplOdd - (Opt)Template for rows with an odd idx value (see idx property).&tplFirst - (Opt)Template for the first row (see first property).&tplLast - (Opt)Template for the last row (see last property).&idx - You can define the starting idx of the rows, which is an property that is incremented as each row is rendered.&first - Define the idx which represents the first row (see tplFirst).&last - Define the idx which represents the last row (see tplLast).&toplaceholder - If set, will assign the result to this placeholder instead of outputting it directly.&debug - If true, will send the SQL query to the MODx log. Fork it -> https://github.com/elastic/loopDbChunkBugs -> https://github.com/elastic/loopDbChunk/issuesShow 3 last resources.Show all approved comments(Quip).Can be used with snippet getPage.<div class="pageNav">
  • 1

  • 2

  • 3

  • 4

  • 5

  • 6
  • >>
  • Last
  • </div>Using &alias, &select, &orderby:Get some records with specified ids:Using &ids for a table where the primary-key isn't id but for example products_id:Connect to a table in a foreign database:/core/components/xt/config/config.inc.php:$database_type = 'mysql';$database_server = 'xxx';$database_user = 'xxx';$database_password = 'xxx';$database_connection_charset = 'utf8';$dbase = 'xxx';$table_prefix = '';
    2.2.1New properties: alias, select, orderby2.1.0New properties: dbConnect, ids, idField, outerTplThanks to Bruno17(https://github.com/Bruno17)!
    Version Released Author Downloads
    2 Versions 1 Contributors 1,238 Downloads
    2.1.0-alpha Jan, 21 2011 elastic 219