end
end
+function nb:ngx_uri_arg(k,v)
+ local uri = ngx.var.request_uri
+ local args = uri:gsub('^[^%?]+%?(.*)$','%1')
+ uri = uri:gsub('^([^%?]+).*$','%1')
+
+ args = args:gsub('^' .. k .. '=[^&]+','')
+ args = args:gsub('&' .. k .. '=[^&]+','')
+
+ if v ~= '' then
+ if args ~= '' then args = args .. '&' end
+ args = args .. ngx.escape_uri(k) .. '=' .. ngx.escape_uri(v)
+ end
+
+ args = args:gsub('^&','')
+ if args ~= '' then uri = uri .. '?' .. args end
+
+ return uri
+end
+
function nb:ngx_rows(url)
local json = require('json')
local rows = json.decode(ngx.location.capture(url).body)
if not rows then rows = {} end
local count = 0 for _,row in pairs(rows) do count = count+1 end
- --local langs = {} langs["eng"] = 1
+ local langs = {} -- langs["eng"] = 1
local count = 0
for _,row in pairs(rows) do
count = count + 1
- --langs[rows.lang] = 1
+ --langs[row.country] = "1"
end
return {
if (!$this->field($f)) continue;
#
# Mime content
- $row[$f] = $field->htmlValue($row[$f]);
+ if ($opt['is_html']) $row[$f] = $field->htmlValue($row[$f]);
$row[$f] = $field->out(isset($row[$f]) ? $row[$f] : '');
echo $this->{"rows_end_$format"}();
if ($opt['is_html']) {
- echo '<div class="nav bottom">'
+ $nav = '<div class="nav bottom">'
.$this->nav($opt['count'],$opt['tot'],$opt['limit'])
.'</div>'.NB_EOL
;
+ echo $nav;
}
} # < out
'enclose' => ["<div class=\"rows\">".NB_EOL,"</div>".NB_EOL],
'tag_enclose' => 'div class="row"',
'tag' => 'div',
+ 'row' => 'out_tag',
'tag_key' => 'label',
'tag_val' => 'span',
# NB 31.01.18 'tag_val' => 'p',
# NB 06.01.18 div.row div span { text-align: right; }
- 'row' => 'out_tag',
# NB 06.01.18 'parse' => function(&$o,&$r) {
# NB 06.01.18 $n = [];
# NB 06.01.18 foreach ($r as $k=>$v) {