NOTICE: All information contained herein is, and remains
the property of TechnoCore.
The intellectual and technical concepts contained
herein are proprietary to TechnoCore and dissemination of this information or reproduction of this material
is strictly forbidden unless prior written permission is obtained
from TechnoCore.
This object is designed to display a country's flag as an HTML <img> tag. It constructs the image URL based on a provided country code and checks if the corresponding flag image exists on the server before generating the HTML.
This object requires flag images to be present in the [SiteBaseDir]/local/flags/ directory. The images must be named according to their two-letter lowercase country code (e.g., us.png, za.png).
The Process method is used to generate the flag image tag. It takes one primary parameter:
If the corresponding image file is found, the method returns an HTML <img> tag. If the file is not found, or if the server context is not available, it returns an empty string.
# Assuming 'obj' is an instance of ObjProcessText
country = "za"
html_output = obj.Process(country_code=country)
# If 'za.png' exists, html_output will be something like:
# <img src='http://your.site.url/image/flags/za.png' width=25px>
country_invalid = "xx"
html_output_invalid = obj.Process(country_code=country_invalid)
# If 'xx.png' does not exist, html_output_invalid will be an empty string.