DBOperations 0.1.0-alpha

DBOperations 0.1.0-alpha

Released Dec 14, 2016 by zabudkin

Perform database operations - select, insert, update.-------------------------------------

Snippet call------------

DBOperations? &p=`placeholder prefix` &q=`query` &o=`operation` &t=`table name` &f=`field list` &w=`where clause` &tpl=`template`

default values: &p=`db`, &o=`select`, &f=`*`, &tpl=``default return: nothingdefault set: placeholders of &t.&fdefault set in template &tpl: [+fieldname+]

for use in variables: %userid% - current userid of loggedin modx user %prefix% - table prefix of installed modx %GET.variable% - value of variable from $_GET array  %POST.variable% - value of variable from $_POST array  %REQUEST.variable% - value of variable from $_REQUEST array %SESSION.variable% - value of variable from $_SESSION array

also available as placeholders (for example: [+GET.variable+]) if you call snippet without arguments, just [[DBOperations]]


Create new document (http://url?parent=2&content=newcontent&pagetitle=newpagetitle):

[!DBOperations? &o=`i` &t=`%prefix%site_content` &f=`{"parent":%REQUEST_parent%,"pagetitle":"%REQUEST_pagetitle%","content":"%REQUEST_content%","published":1}`  !]

Download 5kb (272 downloads)
Downloads: 272
License: GPLv2
Requires Evolution 1.0.x or greater
Compatible up to Evolution 1.1.x
Supports mysql

Initial version

Installation Instructions

  • Create a snippet called DBOperations,  paste content