It's a rather unusual request, but is it possible to extract a subdomain to a variable?
e.g.
(1) sub1.mydomain.com
(2) sub2.mydomain.com
When I click on (1) I want to save "sub1" and vice versa. I use plone (python and tal). Thx for your input.
Just use a Python expression to split at the first dot:
or, if using Python 2.4 or earlier:
This uses
str.partition()orstr.split()to return a list of strings; the local name is the first part;[0]selects the first element of that list.Demo using a Python prompt: