I
indyjason79
I'm in the process of creating a huge Global Website for a large
company. I was wondering how I could separate the code from the text
and I'm starting to look into XML for this. I was thinking I could code
the pages in ColdFusion, and store all the content text in XML
documents. My question is: how do you populate the HTML pages with the
text stored in the XML documents? I've tested the following method, but
I think it would cause a performance issue. I was thinking I could just
pull the XML text and store it in a CF structure, then populate the
HTML using CFOUTPUT tags on the structure. I'm sure there is an easier
way to do this, and that's what I'm looking for. Any help would be
appreciated!
Ex.
XML Document:
<?xml version="1.0" encoding="UTF-8"?>
<content xml:lang="en" engname="English" langname="English"
charset="Windows-1252">
<title>[Home] 7-7000 Online</title>
<lang>en</lang>
<charset>Windows-1252</charset>
<langname>English</langname>
<welcome>Welcome</welcome>
<footer_1_0>This Page Last Updated</footer_1_0>
</content>
CF/HTML Document:
<cfmodule template="custom_tags/xmlParser.cfm">
<cffile action="read"
file="#APPLICATION.properties.cf_path#/#SESSION.user.language##CGI.script_name#.xml"
variable="xml">
<cflock scope="session" type="exclusive" timeout="10">
<cfset SESSION.language = StructNew()>
<cfset SESSION.language = xml2struct(xml)>
</cflock>
<html>
<title><cfoutput>#SESSION.language.content.title#</cfoutput></title>
....
Thanks,
Jason
company. I was wondering how I could separate the code from the text
and I'm starting to look into XML for this. I was thinking I could code
the pages in ColdFusion, and store all the content text in XML
documents. My question is: how do you populate the HTML pages with the
text stored in the XML documents? I've tested the following method, but
I think it would cause a performance issue. I was thinking I could just
pull the XML text and store it in a CF structure, then populate the
HTML using CFOUTPUT tags on the structure. I'm sure there is an easier
way to do this, and that's what I'm looking for. Any help would be
appreciated!
Ex.
XML Document:
<?xml version="1.0" encoding="UTF-8"?>
<content xml:lang="en" engname="English" langname="English"
charset="Windows-1252">
<title>[Home] 7-7000 Online</title>
<lang>en</lang>
<charset>Windows-1252</charset>
<langname>English</langname>
<welcome>Welcome</welcome>
<footer_1_0>This Page Last Updated</footer_1_0>
</content>
CF/HTML Document:
<cfmodule template="custom_tags/xmlParser.cfm">
<cffile action="read"
file="#APPLICATION.properties.cf_path#/#SESSION.user.language##CGI.script_name#.xml"
variable="xml">
<cflock scope="session" type="exclusive" timeout="10">
<cfset SESSION.language = StructNew()>
<cfset SESSION.language = xml2struct(xml)>
</cflock>
<html>
<title><cfoutput>#SESSION.language.content.title#</cfoutput></title>
....
Thanks,
Jason