cmd[23][]=c-1-ICT&cmd[23][]=c-2-%22Jane%20Smith%22You do need to use this e.g. when you want to specify the first condition in your .shtml file, while the second one comes from the URL
Url Parameters
Contents
- 1 Slice parameters
- 1.1 slice_id
- 1.2 conds[]
- 1.3 defaultCondsOperator
- 1.4 neverAllItems
- 1.5 sort[]
- 1.6 x
- 1.7 iview
- 1.8 fview
- 1.9 dview
- 1.10 listlen
- 1.11 slice_pwd
- 1.12 no_scr
- 1.13 group_n
- 1.14 slicetext
- 1.15 highlight
- 1.16 als[alias]
- 1.17 inc
- 1.18 items[id]
- 1.19 hidefulltext
- 1.20 banner
- 1.21 nocache
- 1.22 searchlog
- 1.23 scr_url
- 1.24 sh_itm
- 1.25 restrict
- 1.26 res_val
- 1.27 exact
- 1.28 order
- 1.29 timeorder
- 1.30 scr_go
- 1.31 encap
- 1.32 cat_id
- 1.33 cat_name
- 2 View parameters
- 2.1 vid
- 2.2 cmd[]=v Swap views
- 2.3 cmd[]=i Display item
- 2.4 cmd[]=x Display item
- 2.5 cmd[]=o Display item no hit
- 2.6 cmd[]=c Redefine cond. values
- 2.7 cmd[]=d Redefine conditions
- 2.8 set (combining parameters)
- 2.9 set[]=listlen
- 2.10 set[]=sort
- 2.11 set[]=from
- 2.12 set[]=to
- 2.13 set[]=page
- 2.14 set[]=random
- 2.15 set[]=banner
- 2.16 set[]=noitem
- 2.17 set[]=slice_id
- 2.18 set[]=slices
- 2.19 set[]=selected
- 2.20 als[alias]
- 2.21 nocache
Slice parameters
Origin: ~ToDo: 1767 Which parameters can I use with slice.php3
The slice.php3 is the main script used to display items from database. The alternative for this script is view.php3. The main usage of slice.php3 script is to include it into some .shtml file via SSI include command. Example:
<!--#include virtual="/aaa/slice.php3?slice_id=a91256ed53287912d74495d781076bd6"-->
The following parameters can be added as url parameters. It is possible to combine more than one parameter. Example:
<!--#include virtual="/aaa/slice.php3?slice_id=a91256ed53287912d74495d781076bd6&listlen=10&no_scr=1"-->
The slice.php3 script is there from the beginning of ActionApps, so some of the parameters are quite old. Such parameters are still implemented, but in many cases it is better to use newer - more powerfull substitution for the parametr. That's why the list is prioritized from the most common parameters (which should be used) to the old parameters (which are deprecated).
slice_id
A long ID of the slice you want to display. Example:
slice_id=a91256ed53287912d74495d781076bd6
conds[]
Very usefull for complex conditions - see Setting up a search from for conds parameter setting (it can be used as url parameter too - not only form Forms, as described in search section)
Example:
conds[0][category........]=Environment&conds[1][category........]=Waste
defaultCondsOperator
Replaces LIKE for conds with not specified operator - simplified syntax of conds Setting up a search from uses LIKE operator as default - you can change it by this operator to RLIKE for example (RLIKE is better in many cases - at least it is much faster from database point of view) Example:
defaultCondsOperator=RLIKE&conds[0][category........]=Environment
neverAllItems
If set, don't show anything when everything would be shown (if no conds[] are set) - good for search pages, where on the top (or bottom) is searchform - normaly, for the first time (when you did not send the searchform), all items are shown - if you want to have there only blank page intead, use this parameter
Example:
neverAllItems=1
sort[]
See Setting up a search from - very usefull for complex sorting and ordering
Example:
sort[0][pub_date........]=d&sort[1][headline........]=a
(a ...ascending order; d ... descending order)
x
Tells the slice script to switch to use fulltext view (instead of index view) and display the item numbe x
Example:
x=1234
iview
Changes the design of index item listing to the design defined in specified view. The view should be of Item listing type.
Example:
iview=49
listing of items generated by slice.php3 will use format-strings as defined in view No. 49
fview
Changes the design of fulltext to the design defined in specified view. The view should be of Fulltext view type.
Example:
fview=48
the item displayed by the slice.php3 script will use format-strings as defined in view No. 48
dview
Uses specified view for discussions instead of the one specified on 'Slice Admin' -> 'Design - Fulltext' page. (good for testing new discussion view, ...)
Example:
dview=18
view 18 is used as tepmlate for discussion design in this slice
listlen
Change number of listed items in compact view
Example:
listlen=10
slice_pwd
Passes the password onto the slice if the slice is password protected against reading.
Example:
slice_pwd=VerySecret
no_scr
When set to 1, it surpressess the display of page scroller (which normaly happend automatically if the list of items to be displayed is longer than listlen.
Example:
no_scr=1
group_n
Displayes only the n-th group (in listings where items are grouped by some field (category, for example)) - good for display all the items of last magazine issue
Example:
group_n=1
slicetext
Displays just the text instead of any output - can be used for hiding the output of slice.php3 Example:
slicetext=%20
highlight
When set to 1, it shows only highlighted items in compact view
Example:
highlight=1
als[alias]
User alias definition - you can define your own aliases in url (for both - slice.php3 and view.php3). Aliases names MUST!!! be 8 characters long. Don't forgot, that the alias value have to be urlencoded.
Example:
als[MY_ALIAS]=Summary%20Page
Defines alias _#MY_ALIAS. If used in formatstring ('Admin - Design Index' for example), it prints 'Summary Page'
inc
For displaying another file instead of slice data (for example some static html file) Example:
inc=/contact.html
items[id]
Array of items to show one after one as fulltext (ids are the long ones - see sh_itm, but there is special 'x' character before each index).
Example:
items[x5462876e8ab29ac95462876e8ab29ac9]=1&items[x65ac876e8a555b29543ea76e8ab29a34]=1
Doesn't matter which value is given to element (1 or 'on' or ...) - good for display of the form, where you select which item to show.
hidefulltext
If you add this parameter to url, the fulltext is not shown when you go to page, where the specific item should be displayed. The discussions under the fulltext are not hidden. It is usefull, if you want to show discussions for the item on separate page. On the other hand, probably better results You can get by using #fview parameter.
banner
This parameter allows you to display banners through views. In the example belov, a view no.38 inserted just after the second item in view (number 23). The item shown in inserted view (38) is selected randomly, possibly with weight specified in weight field (number.........1) - just like in random parameter described above. If you do not want use random item (banner), use 'norandom' keyword in place of 'weight field' (good for displaying nested newsbox). See also banner parameter for view.php3.
Example:
banner=2-38 or banner=2-38-number.........1 or banner=2-38-norandom
nocache
URL parameter for page refresh - the items are not taken from the page cache (- no matter if allready cached or not). Cache is updated. Example:
nocache=1
searchlog
If you add searchlog parameter to the slice.php3 script on some search page, all searches (by conds[]) are logged into database table searchlog. There are logged not only the conds[] parameters, but also the time, which database spent on the query. The access to the log is for superadministrators only, right now. You will find it on 'AA' -> 'Misc -
' page in AA admin interface (or you can look into searchlog table in the database).
scr_url
scr_url parameter is answer to problem mentioned in apc-aa-general mailinglist (apc-aa-general mailinglist). If you try to include the slice.php3 into your php3 script by calling include("http://www.sitename.org/apc-aa/slice.php3...");, the page scroller do not work, becouse the called script (slice.php3) do not know from which script it was called. But the scroller should know it - scroller should point to the same page - to the calling one. By scr_url parameter you can define the name of calling script. Example:
include("http://www.sitename.org/apc-aa/slice.php3?...&scr_url=%2Fscripts%2Findex.php");
('%2F' stands for ' / ' character).
sh_itm
id of item to show - if specified, selected item is shown in full text
Example:
index.shtml?sh_itm=01ac1b10fae13c0a61c5292ba72d70b1
restrict
Field id used with "res_val" and "exact" for restricted output (display only items with "restrict" field = "res_val"
Example:
restrict=category........&res_val=Environment&exact=1
res_val
see restrict
exact
If set, restrict field must match res_val exactly (=) otherwise substring is sufficient (LIKE '%res_val%')
order
Order field id - if other than publish date add minus sign for descending order
Example:
order=headline........
timeorder
If rev - reverse publish date order (less priority than "order")
Example:
timeorder=rev
scr_go
Sets page scroller to specified page
Example:
scr_go=2
encap
Determines wheather this file is SSI included to .shtml file (<--#include virtual="... ) or called directly as slice.php3
Example:
encap=false
cat_id
Select only items in category with id cat_id. Deprecated - better to use restrict and res_val parameters - or even better conds[] parameter
cat_name
Select only items in category with name cat_name as substring. Deprecated - better to use restrict and res_val parameters - or even better conds[] parameter
View parameters
Origin: ~ToDo: 1766 Which parameters can I use with view.php3
The only required parameter view.php3
script requires is the number of the view you want to display. This value is passed through the vid
parameter. Other parameters are optional.
Each optional view parameter begins with cmd[x], where x is view number in which the parameter should be used. This is needed because of possibility to include more than view to one shtml page. That's why we need to specify, for which view the command should work.
It is impossible to specify more than one cmd for one view. If you want to use cmd[]=d for the view, you can't use it with combination with cmd[]=c, for example.
The above is still true, even after CVS snapshot 20031109, since when you can also use this syntax: vid=x&cmd[x][]=c-1-<something>&cmd[x][]=c-2-<something>. Note the extra [].
'
However, you can use more settings (set[x]) per view. Just seperate settings with a comma, like: set[23]=from-10,to-20.
After the cmd[x]= is always character, which specify which command is used - how modify the view. The c command modifies conditions, for example. The values after command character are user parameters and its meaning is different for each command. The parameters are separated by - character. If you need to use a hyphen - in a parameter, use 2 hyphens -- instead. Description of parameters is in following table of examples.
vid
Id of the view to display Example:
vid=4
cmd[]=v Swap views
This command be used to dynamicaly swap views. Example:
cmd[23]=v-25
show view number 25 instead of view number 23
cmd[]=i Display item
Use a specified view to display a certain item. Example:
cmd[23]=i-24-7464647
view number 23 will display item 7464647 in a format defined by view 24
cmd[]=x Display item
The same as i, but there you can use both - short_id or long item id (as the last parameter) Example 1:
cmd[23]=x-24-1589
Example 2:
cmd[23]=x-24-1589-1545-1612
Display all three specified items. You can use as many ids as you want (the same works also for 'i' and 'o' cmd). This behavior is used for displaying related items, where related fields are displayed by {view.php3?vid=33&cmd[33]=x-33-{@relation.......1:-}} (see Syntax#.7Bview.7D_-_Including_Views.
Note:
cmd[23]=x-24-url
You can use the keyword url
instead of the item ID, which will cause the view to take the item ID from the url parameter x
.
cmd[]=o Display item no hit
The same as x, but the number of item display (countHit) is not increased (the only difference from x and i) Example:
cmd[23]=o-24-1589
cmd[]=c Redefine cond. values
Some view types have up to 3 conditions which can be set to default values in the admin interface. This command allows you to dynamicaly (and temporarily) redefine the values for those conditions Example 1:
cmd[23]=c-1-ICT
displays view no 23 in place of view no 23 (that's normal), but change value for condition 1 to "ICT" Example 2:
cmd[23]=c-1-ICT-2-%22Jane%20Smith%22
The same as above, but there are redefined two conditions. All three conditions could be redefined, notice how "Jane Smith" requires urlencoded double quotes %22 or the search won't work, and the space turned urlencoded to %20 otherwise it would be interepreted as Jane OR Smith
cmd[]=d Redefine conditions
Allows you to redefine all three elements that constituate view condition.
Example:
cmd[23]=d-headline........-LIKE-Profit-source.........1-=-Ecn-publish_date....-m:>-86400
displays view no 23 and redefines the conditions. The conditions are in format field-operator-value. For list of possible operators see search caption. The operators could be with its modifiers, too. The unlimited number of conditions can be specified. This command allways replaces all conditions specified in view definition (through admin interface). There are three diferences from cmd[]-c command
- operators and fields are specified
- default view conditions are ingnored
- there can be an unlimitted number of conditions
The example would show items in which the headline contains Profit and source field is Ecn and the item is newer that one day.
Example 2:
cmd[23]=d-headline.......1,category........-RLIKE-Enviro
You can use more than one field in one condition. Example displays items where headline.......1 OR category........ begins with Enviro
set (combining parameters)
You can combine any mix of the parameters below into a single set[] command using ',' (comma) as a separator.
Example:
set[25]=page-4,listlen-3
set[]=listlen
Example:
set[23]=listlen-20
set parameter can be used to modify view behavior and can be combined with cmd sets maximal number of viewed items in view 23 to 20 - there can be more settings - comma separated
set[]=sort
Set sorting order Example:
set[23]=sort-headline.......1
set item order use sort-headline.......1-
for descending sort order
set[]=from
Set ralative position of the first item on the list
Example:
set[23]=from-10
Displays items from 10-th (in view 23) - it can be combined with listlen
, to
, ... parameters (set[23]=listlen-20,from-5
)
set[]=to
Displays items to 15-th (in view 23) - usefull if combined with from parameter Example:
set[23]=from-2,to-9
set[]=page
Example:
set[23]=page-2-3
Displays second page from 3 (in view 23) - it didvides all matching items into 3 pages and displays the second one. If you do not specify the second parameter (3 in our example), the page will be listlen items long.
set[]=random
Examples:
set[23]=random-1 set[23]=random-number.........1
Selects item(s) to show randomly. If you use the random-1 parameter, any item in Active bin is displayed. If You use field_id instead of '1', then the content of field specified by field_id is used as probability to show the item. Let's have two items. The parameter looks like random-number.........1
. The first item has the number.........1
filled with number 10, the second with 50. Then the second item will be displayed 5x more offten than the first one. The 'weight numbers' and 'number of displayed items' are unlimited. This feature is used for ad-banners.
Examples:
set[23]=banner-2-38 set[23]=banner-2-38-number.........1 set[23]=banner-2-38-norandom
by this parameter you are able to display any view (38 in or case) inserted just after the second (2) item in view (number 23). The item shown in inserted view (38) is selected randomly, possibly with weight specified in weight field (number.........1
) - just like in random parameter described above. If you do not want use random item (banner), use 'norandom' keyword in place of 'weight field' (good for displaying nested newsbox). See also banner parameter for slice.php3
. The example of included banner is on http://ecn.cz.
set[]=noitem
Example:
set[23]=noitem-Not%20found
Redefines the 'Not item found' message in view.
set[]=slice_id
Example1:
set[23]=slice_id-79a69a0ad73c81ac332b0e8c4c3cea93
Redefines the slice from which the items will be displayed.
set[]=slices
Example1:
set[23]=slices-79a69a0ad73c81ac332b0e8c4c3cea93-45639a0ad73c81ac332b0e8c4c3cea44
Displays items from two or more slices
set[]=selected
Example:
set[23]=selected-182763
Assigns '1' to special _#SELECTED alias for item id 182763. It is usefull for displaing menu generated from slice items, if you want to highlight selected menu item.
{view.php3?vid=23&set[23]=selected-{x}}
Calling view 23 (which dislays menu) from sitemodule, where {x} contain id if current item
<li {switch({_#SELECTED})1:class="highlighted"}>_#HEADLINE</li>
Odd Row HTML code which displays menu items. The selected item will be marked by class="highlighted"
als[alias]
User alias definition - you can define your own aliases in url (for both - slice.php3 and view.php3). Aliases names MUST!!! be 8 characters long. Don't forget that the alias value have to be urlencoded.
Example:
als[MY_ALIAS]=Summary%20Page (or properly: als%5BMY_ALIAS%5D=Summary%20Page)
defines alias _#MY_ALIAS. If used in formatstring ('Admin - Design Index' for example), it prints 'Summary Page'
nocache
Disables caching of view, slice or site. nocache
parameter should be used mainly for debug purposes, since cache reduces load of the server quite a lot.
Example:
nocache=1
The view is not taken from cache (- no matter if the view is already cached or not). Cache is updated.
Example:
nocache=invalidate
The view is not taken from cache and cache entry for current view (view with specified url parameters) is removed.