Carma retrieve sections
From TMM Wiki
Jump to navigationJump to searchcarma_retrieve_sections
- Purpose: Retrieve section data for linking.
- Usage: {carma_retrieve_sections type="child"}
- Required: none
- Optional: start, type, assign
- Templates Used: none
Parameters
(Required parameters in bold)
Parameter | Description | Possible Values | Default Value | Example |
---|---|---|---|---|
start | Start at this section ID | Any valid section I.D. | Current section | start="123" |
type | What info to retrieve | child, children, same, parent, path (see Notes section below) | None. | type="child" |
order | Put the returned sections in this order (Only for child, children, same, parent) | active, caption, name | name | order="active" |
assign | Name of the Smarty variable that stores the output | Any valid Smarty variable name | carma_retrieve_sections | assign="my_var" |
live_content | Only display sections with live content | 1 | None. Displays all sections | live_content="1" |
Description
This function retrieves the requested sections and stores them into the variable set in assign. The structure of the data retrieved depends on the type setting:
- current / child / same / parent: simply an array. key secid, value is all the section data.
- children: 2-dimensional array. First key is the parentid, second key is the actual secid, value is the section data. Value also has a special entry called children which is a 1-dimensional array with all children under this parent, key is secid, value is section data (which will have children too!)
There are 2 logical orders you might want to use: name - ordering by the name of the section, ascending; last_update DESC - ordering by when the section was last updated, descending order.
Notes
The following list describes options for the type parameter:
- current: retrieves only the current section or the section referenced by the start parameter
- child: retrieves only the sections below start
- children: retrieves the sections below start and all the sections below those
- same: retrieves only sections with the same parent as start
- parent: retrieves only sections on start's parent level
- path: retrieves the path from 0 to start