Skip to Content Skip to Menu

Substitution for a constant value in CB

  • krileon
  • krileon
  • ONLINE
  • Posts: 48419
  • Thanks: 8274
  • Karma: 1443
1 year 9 months ago #332278 by krileon
Replied by krileon on topic Substitution for a constant value in CB
It's a substitution. So you need to be sure your auto action has substitutions applied to whatever parameter you're using that in. Ensure substitutions are toggled on for the auto action under the Parameters tab. CB Auto Actions also has a format function to deal with inline translates as described under the Parameters tab. Example as follows.

[cb:parse function="translate"]LANGUAGE_KEY_HERE[/cb:parse]

You should also just be able to use it directly as a language string if you're not using it inline in the middle of content. So for example ensure Translate is set to Yes under Parameters then just set the value of the parameter you're trying to do this in to your language key (e.g. DEV_KEY).


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • activha
  • activha
  • OFFLINE
  • Posts: 2326
  • Thanks: 117
  • Karma: 13
1 year 9 months ago - 1 year 9 months ago #332280 by activha
Replied by activha on topic Substitution for a constant value in CB
I tried all the different methods but no success so far.
Mind to test if it works on a Request AutoAction with a Get method and the key in the action tab ?
Even the parse function does not function.

It's difficult to debug because the autoaction does not input the result, only errors in the code.

PS: I have added the key only in the default languages/override so that it works for all languages at start
Last edit: 1 year 9 months ago by activha.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48419
  • Thanks: 8274
  • Karma: 1443
1 year 9 months ago #332282 by krileon
Replied by krileon on topic Substitution for a constant value in CB

 PS: I have added the key only in the default languages/override so that it works for all languages at start

That's not how language overrides work. They only apply to the language they're added to. If you added it to the default language, but not the French language then when French is loaded the language string will not exist. In multi-lingual setups you need to add it to every language to be used as a constant like this.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • activha
  • activha
  • OFFLINE
  • Posts: 2326
  • Thanks: 117
  • Karma: 13
1 year 9 months ago #332284 by activha
Replied by activha on topic Substitution for a constant value in CB
ahhhh ok that explains the issue...
Thanks I did not even noticed this point

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48419
  • Thanks: 8274
  • Karma: 1443
1 year 9 months ago #332285 by krileon
Replied by krileon on topic Substitution for a constant value in CB
I can't really think of a way to add a true global constant like that without doing something like adding it to configuration.php maybe and trying to access it via config APIs or maybe in PHP itself just define a constant. We've never really needed to cover such a usecase and is probably unlikely we ever will. The alternative is to make a small plugin that adds a new param to CB configuration. Our footer removal plugin does exactly that so you could use it as a base.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum