Loading...
 
Features / Usability

Features / Usability


Re: Forcing word case

posts: 214

I am not sure why you think the solution I gave would require any PHP programming.  Did you try my suggestion?

Tiki's wiki syntax does not have a "force upper case" or "force lower case" option.  Tiki wiki syntax is extended with plugins.  There are no "force upper case" or "force lower case" plugins, but some plugins have options that could be used to lower case a string.

Your example used the page name variable as the thing you wanted to force into lower case.  

The page name is also available in a smarty variable, $page. And there is a smarty plugin which gives you access to smarty variables and smarty functions.
So your example:

Copy to clipboard
[http://example.com/wiki/lang/{ {page}}| ForceCase(, case="lower")|new]

Could be accomplished by using the smarty plugin:

Copy to clipboard
[http://example.com/wiki/lang/|{smarty name="eval" var="{$page|lower}"}|new]

The "|lower" after the $page in the "var=" applies the smarty lower function to the $page smarty variable.  It doesn't need any other programming.

If that wasn't what you wanted, maybe you could explain it with more examples?

You can find out all of the smarty variables available to you by turning on the "Debugger Console" and having it list out all the smarty variables.

Go to Features, select the "Programmer" tab, and enable "Debugger Console".
Once that is done, there will be a new option in the menu: "(debug)".
Click on that option and then scroll to the top of the page and there should be a "Debugger Console" with a "Command:" text box.
If you enter "slist" for the command and click on "exec", it will list all of the smarty variables.
But I recommend you enter "help" for the command and click on "exec" for more information before doing the "slist" command.


There are other plugins which could be used to set text into lower case.

The Tag plugin with the style parameter "text-transform: lowercase;" could be used to change the case to lower.  In your example it would be:

Copy to clipboard
[http://example.com/wiki/lang/|{TAG(style="text-transform: lowercase;")}{TAG}|new]


I don't recommend using this next option because it will not work after PHP version 5.5.

Plugin Regex could also be used (but only for PHP versions 5.5 or lower as that plugin uses PHP preg_replace and to change the case of the letters would require the "\e" modifier which was depreciated in PHP 5 and is ignored in PHP 7).

Create a webpage named "ForceLowerCase".
Put the string below as the only thing on that page:

Copy to clipboard
/A-Z/e::strtolower("$0")

and then save the page.

In your example, to use the Regex plugin with the ForceLowerCase page to change the case of the page name would be:

Copy to clipboard
[http://example.com/wiki/lang/|{REGEX(pageName="ForceLowerCase")}{REGEX}|new]

(This did work with PHP Version 5.5.13 and Tiki 15.0 svn though.)

Tom

 

 

There are no comments at this time.

Upcoming Events

1)  18 Apr 2024 14:00 GMT-0000
Tiki Roundtable Meeting
2)  16 May 2024 14:00 GMT-0000
Tiki Roundtable Meeting
3)  20 Jun 2024 14:00 GMT-0000
Tiki Roundtable Meeting
4)  18 Jul 2024 14:00 GMT-0000
Tiki Roundtable Meeting
5)  15 Aug 2024 14:00 GMT-0000
Tiki Roundtable Meeting
6)  19 Sep 2024 14:00 GMT-0000
Tiki Roundtable Meeting
7) 
Tiki birthday
8)  17 Oct 2024 14:00 GMT-0000
Tiki Roundtable Meeting
9)  21 Nov 2024 14:00 GMT-0000
Tiki Roundtable Meeting
10)  19 Dec 2024 14:00 GMT-0000
Tiki Roundtable Meeting