At https://getkirby.com/docs/cheatsheet/options/tinyurl-enabled I can read:
I have installed a fresh Kirby Starterkit 2.5.8 and only added a very last line at site\snippets\header.php
:
<p>tinyurl.enabled: <code><?php ecco (c::get('tinyurl.enabled'), 'TRUE', 'FALSE'); ?></code></p>
I get:
tinyurl.enabled: FALSE
Something is wrong.
Hint:
I know, how to change this using site\config\config.php
- options.
1 Like
That you are getting false
when printing the value is caused by the internal Kirby code structure. If the option isn’t set by the user, the value is internally set but not exposed to c::get()
.
However I verified that the tinyurl feature is enabled by default. If you print a tinyurl with $page->tinyurl()
and visit the printed URL, the redirect works as expected without any configuration changes.
By the way: Instead of using ecco()
to print boolean variables, you can use var_dump()
. It’s better suited for stuff like that.
1 Like
Thank you Lukas for your verification of my post!
Now I know, that I have to use instead:
<p>tinyurl.enabled: <code><?php ecco (($page->url() <> $page->tinyurl()), 'TRUE', 'FALSE'); ?></code></p>
ecco ()
fulfills my desired purpose, but your hint to use var_dump()
is very nice.
Even better:
$kirby->option('tinyurl.enabled')
In contrast to c::get()
, the $kirby->option()
method has access to the internal state and can return the correct value.
2 Likes