External Variables???
-
Ok, I'll try to make this as short as possible. I have wrote a C# app that creates static HTML pages. One of the pieces for each page is obviously the keyword meta tags. To thicken the plot, this same program generates the same pages for different sites. But different keywords for each site. What I'm trying to accomplish is to have an external XML file that basically "defines" what the keywords are for each site. My question is this, what if I want to change say the Persons name for each of my pages, but using the same keywords. Example: Visit Bob Smith's Home Page My Application is going to have the name Bob Smith defined, so basically when I import my XML it needs to have a place for a variable. So the XML file should read Example "Visit" + theName + " Home Page". So when it comes into my app + theName + get's defined as Bob Smith's. Obviously it doesn't work this way and I need it to. Any ideas. Hope I haven't confused the hell out of everyone :) -Brent
-
Ok, I'll try to make this as short as possible. I have wrote a C# app that creates static HTML pages. One of the pieces for each page is obviously the keyword meta tags. To thicken the plot, this same program generates the same pages for different sites. But different keywords for each site. What I'm trying to accomplish is to have an external XML file that basically "defines" what the keywords are for each site. My question is this, what if I want to change say the Persons name for each of my pages, but using the same keywords. Example: Visit Bob Smith's Home Page My Application is going to have the name Bob Smith defined, so basically when I import my XML it needs to have a place for a variable. So the XML file should read Example "Visit" + theName + " Home Page". So when it comes into my app + theName + get's defined as Bob Smith's. Obviously it doesn't work this way and I need it to. Any ideas. Hope I haven't confused the hell out of everyone :) -Brent
Hi Brent, It sounds almost like you want to add meta tags to your meta files. :) Actually, it's not uncommon to have a file template that is pre-processed in order to feed it to the appropriate consumer. A classic example is the pre-processor .h files used by C/C++ compilers. However, in your case, you want to take existing XML files and use them directly with text replacement. Probably not very easy to do with the XML parser directly, but perhaps you can consider this: Create your own "XML template" with a different file extension; allow a certain delimiter to define 'tags' in the XML file which don't clash with the XML syntax. Create a component which can take a collection of name-value pairs, and the name of your file to read the file, parse out the 'tags', and replace the name of the tag with the value in the collection (with the tag name as the key). The resulting text replacement is then the new "dynamic XML" that you can then feed to your application. There are probably other ways of doing such with XSL, but that's one realm I've not yet trodden. Regards, Joe
-
Hi Brent, It sounds almost like you want to add meta tags to your meta files. :) Actually, it's not uncommon to have a file template that is pre-processed in order to feed it to the appropriate consumer. A classic example is the pre-processor .h files used by C/C++ compilers. However, in your case, you want to take existing XML files and use them directly with text replacement. Probably not very easy to do with the XML parser directly, but perhaps you can consider this: Create your own "XML template" with a different file extension; allow a certain delimiter to define 'tags' in the XML file which don't clash with the XML syntax. Create a component which can take a collection of name-value pairs, and the name of your file to read the file, parse out the 'tags', and replace the name of the tag with the value in the collection (with the tag name as the key). The resulting text replacement is then the new "dynamic XML" that you can then feed to your application. There are probably other ways of doing such with XSL, but that's one realm I've not yet trodden. Regards, Joe
Hi Joe, Yea, that's exactly what I ended up doing. I defined variables in my XML file with @FirstName@ @LastName@ etc. and then just look for those values once I import the XML....works pretty damn nicely. Like you said, probably a better way, but I'm only dealing with about 6 variables at any one given time so it works :) Thanks for the response though!! -Brent
-
Hi Joe, Yea, that's exactly what I ended up doing. I defined variables in my XML file with @FirstName@ @LastName@ etc. and then just look for those values once I import the XML....works pretty damn nicely. Like you said, probably a better way, but I'm only dealing with about 6 variables at any one given time so it works :) Thanks for the response though!! -Brent
Hi there, No problem, actually, I've used that approach in the past on other project. It does work nicely and the best thing about it is that it's configurable after you've written the code that uses it. (You just have to make sure you don't break what you feed the code!) It's a good way of branding Web sites, nice to see someone out there thinking that way. :) Regards, Joe