Use
Create
Develop
FAQ
Troubleshooting
History: Branching
View page
Show All Versions
Source of version: 8
«
»
From Tiki 15 onwards, it is possible to include contents of other YAML files in profiles depending on branching logic. !Basic usage The basic usage is through the use of the !include directive. In YAML, the "!" preceding the string means that that is a directive and some kiind of execution is to happen, returning some kind of output that replaces the directive. The following is an extremely basic example on how it works: test.yml {CODE()} preferences: feature_wysiwyg: - !include wysiwyg.yml 1 eq 1 - !include nonwysiwyg.yml {CODE} wysiwyg.yml {CODE()} feature_wysiwyg: y {CODE} nonwysiwyg.yml {CODE()} feature_wysiwyg: n {CODE} Each of the options of YAML files to include for a particular key (in the above case, feature_wysiwyg) is an item in a list starting with the !include directive followed by the filename (relative to the profile), and then a condition comparing 2 values using operators. If the condition is true, then it includes that YAML file and ignores the other conditions. If not it moves on to the next option and performs the test again. It is customary to provide a default YML file in case any of the preceding conditions are not met. This works pretty much is the same way as a typical CASE structure in PHP. In the above example, wysiwyg.yml will be included and therefore wysiwyg will be on. If on the other hand: {CODE()} preferences: feature_wysiwyg: - !include wysiwyg.yml 1 eq 2 - !include nonwysiwyg.yml {CODE} since 1 not equals 2, it will default to the nonwysiwyg.yml and set feature_wysiwyg to 'n'. Note that the contents of the included YAML files should start with the same key as that to be replaced. For example, wysiwyg.yml and nonwysiwyg.yml both start with "feature_wysiwyg". !Comparison operators eq: equal to neq: not equal to lt: less than le: less than or equal to gt: greater than ge: greater than or equal to !Using references !!Checking value of preferences To build on the above, it is possible to check the value of the preference and then decide which YAML file to include. For example, {CODE()] preferences: feature_wysiwyg: - !include wysiwyg.yml $preference:feature_page_title$ eq y - !include nonwysiwyg.yml {CODE} !Limitations *Included YAML files themselves cannot contain !include statements. *There is no way to do boolean comparisons
History
Enable pagination
rows per page
HTML diff
Side-by-side diff
Side-by-side diff by characters
Inline diff
Inline diff by characters
Full side-by-side diff
Full side-by-side diff by characters
Full inline diff
Full inline diff by characters
Unified diff
Side-by-side view
Information
Version
Wed 25 of Nov, 2020 12:34 GMT-0000
Jonny Bradley
Added some aliases to help searching
14
Actions
View
Source
Wed 04 of Dec, 2019 21:28 GMT-0000
luciash d' being 🧙
formatting
13
Actions
View
Source
Wed 04 of Dec, 2019 18:51 GMT-0000
luciash d' being 🧙
highlight code
11 - 12
Actions
View
Source
Tue 27 of Oct, 2015 23:36 GMT-0000
Nelson Ko
add example
10
Actions
View
Source
Tue 27 of Oct, 2015 19:29 GMT-0000
Nelson Ko
fix typo
3 - 9
Actions
View
Source
Tue 27 of Oct, 2015 15:50 GMT-0000
Nelson Ko
Some editing
1 - 2
Actions
View
Source
Select action to perform with checked...
Remove
OK
Menu
Featured profiles
Profiles in Wizard
Profiles Todos
Handlers
Profiles Tester
Admin
of this site
Current Profiles
Tiki version
21.x
24.x
26.x
27.x
28.x
Deprecated
25.x
state
Not fully functional yet
alpha
beta
release
type
Available in the Profiles Wizard (12+)
Featured profiles
Full profile (out of the box & ready to go)
Learning profile (to show off feature)
Long tail
Mini-profile (can be included in other)
Profile-snippet (optional but needs another "parent" profile)
Security
Tests
Latest Changes
test_profile_change
test_new_personal_blog_and_profile
test_new_personal_blog_and_profile_vlog_include
Bootstrap Row and Col Plugin Aliases
Profile_Test_all_Modules_Test_all_Modules_page
Bug_Tracker_16
Bug_Tracker_16
Profile_Tracker_as_Calendar_page_09
Tracker_as_Calendar_09
TikiKart_Product_Include
Shopping_Cart
Scheduler_Presets_20
test_new_personal_blog_and_profile_post3_include
test_new_personal_blog_and_profile_post2_include
test_new_personal_blog_and_profile_post1_include
test_new_personal_blog_and_profile_about_include
test_new_personal_blog_and_profile_social_include
R_demo
Voting_System
Test_all_tracker_field_types_profile
...more
Like almost all *.tiki.org sites, you can log in with your login from
https://tiki.org
(register over there)
Search
Find
Most Popular Tags
admin
agenda
alias
antibot
antibot captcha
app
archive
articles
banning
batch
blogs
calculations
calendars
cart
categories
cluster
codemirror
comments
computation
contact us
datachannel
debug
debug console
dropdown with other
error messages
features
file galleries
forums
geo
geocms
geolocation
group homepages
group watches
header
i18n
images
item link
items list
jquery
languages
location
map
maps
maths
menu
menupage
multilingual
ol3
ol5
openlayers
paypal
plugin
plugin alias
plugin datachannel
plugin fade
plugin tabs
plugin trackerlist
pretty trackers
print
project management
r
r project
realnames
rss
static
static text
statistics
stats
structures
syntax highlighter
tablesorter
template
trackers
user watches
visualization
watches
webservice
wiki
wiki argument variables
wiki structures
Tiki Newsletter
Subscribe to the Tiki newsletter.
Don't miss major announcements and other news!