kepler Posted September 1, 2017 Share Posted September 1, 2017 Good afternoon I just wanted to place a doubt - maybe someone can help me. In a email template of WHMCS, I want to send a text IF the domain is actually a subdomain of the main. I could use an {if}...{/if} with the product variable {$service_product_name} But is there a way of using a regex for the var {$service_domain} to see if it's a subdomain of example.com for instance? I don't know very well this scripting language... Also, I would like to place a question: I have for the emails the default language (english) and a 2nd option. Even if I place in the general settings that 2nd language, the emails are sent in english. Is there an extra configuration I'm missing...? Kind regards Kepler 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted September 2, 2017 Share Posted September 2, 2017 I just wanted to place a doubt - maybe someone can help me.In a email template of WHMCS, I want to send a text IF the domain is actually a subdomain of the main. I could use an {if}...{/if} with the product variable {$service_product_name} But is there a way of using a regex for the var {$service_domain} to see if it's a subdomain of example.com for instance? I don't know very well this scripting language... I would have thought you could just do this... {if $service_domain|strstr:'.example.com'} do something {/if} Also, I would like to place a question: I have for the emails the default language (english) and a 2nd option. Even if I place in the general settings that 2nd language, the emails are sent in english. Is there an extra configuration I'm missing...? https://docs.whmcs.com/Email_Templates#Translating_Email_Templates has the client chosen this second language or is their profile set to default/english ? 0 Quote Link to comment Share on other sites More sharing options...
kepler Posted September 2, 2017 Author Share Posted September 2, 2017 I would have thought you could just do this... {if $service_domain|strstr:'.example.com'} do something {/if} Hi, Thanks for the reply. I think it's a beginning, but there can be the problem of $service_domain be http://www.example.com How can I exclude the www possible match? Could I write something like: {if $service_domain|strstr:'.example.com'}|!strstr:'www.example.com'} Does the ! acts in this type of conditional? I dont know how to put the or (|) and the and (&?) or the not (!) in this script... It's not exactly php per se... Kind regards, Kepler 0 Quote Link to comment Share on other sites More sharing options...
WHMCS Developer WHMCS Andrew Posted September 4, 2017 WHMCS Developer Share Posted September 4, 2017 {if $service_domain|strstr:'.example.com'}|!strstr:'www.example.com'} Would actually be: {if $service_domain|strstr:'.example.com'}&& $service_domain != "www.example.com"} And I would actually go a little further: {if $service_domain != "www.example.com" && $service_domain|strstr:'.example.com'} ------ Email Templates: Changing the default language in Setup -> General Settings changes the default language of your email templates. That means that the "English" version you had is now "Italian" or "Spanish" or whatever you chose as your new default language. If you wish to keep the English version, you would need to add this as a language on your email templates and then re-edit the default templates to be your new default language. 0 Quote Link to comment Share on other sites More sharing options...
kepler Posted September 4, 2017 Author Share Posted September 4, 2017 Good morning Thank you very much Andrew Kind regards, Kepler 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.