• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Delay execution of CFML

New Here ,
Mar 22, 2008 Mar 22, 2008

Copy link to clipboard

Copied

Hi there

I manage a site that "pre-generates" pages, so that the execution time is quicker and the demands on the server are reduced when users come to the site.

The problem is this. I have a template that contains CFML that looks to see the browser that the user is using. When the pages are "pregenerated" using say IE and the user visits using Firefox, the pages to not render properly, because the pregeneration process inserts a reference to the stylesheet for IE, and not Firefox (which makes sense).

I would simply like to "include" the code that determines which stylesheet should be used in the pregenerated page so that it is executed when the user visists the site, rather than the pregenerated page executing that code when the page is created.

Is anyone able to assist?

Thanks for your help in advance.

Goofy

TOPICS
Advanced techniques

Views

436

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 24, 2008 Mar 24, 2008

Copy link to clipboard

Copied

It's not quite clear to me what the problem is. From what I can guess, you could solve the problem by adding code to choose the style in Application.cfm or Application.cfc, thus

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 24, 2008 Mar 24, 2008

Copy link to clipboard

Copied

Thanks very much for your response.

The problem is, my CF code (similar to that which you have set out below) executes when I pregenerate my page. So, if I were pregenerating the pages using (say) IE7, the line of code "<LINK href="ie7_style.css" rel="stylesheet" type="text/css">" would be inserted into the page, which would then be live on the website. If a person comes along and views the page using Firefox, Opera, IE6 or any other broswer, the IE7 css will be used, because the line <LINK href="ie7_style.css" rel="stylesheet" type="text/css"> is already in the template.

What I want to do is insert the code (such as yours below) into the template that server executes when the Firefox (or other) user comes to the site.

Does this assist?

Regards

Goofy

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 25, 2008 Mar 25, 2008

Copy link to clipboard

Copied

You are simply going to have to modify your pre-generation process so
that it does not generate this part of your template. Leaving it
dynamic to be generated at run time.

Since none of us has any idea how your pre=generation works or how you
want it to work, it would be very hard to give much more specific advice.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 25, 2008 Mar 25, 2008

Copy link to clipboard

Copied

You could proceed as follows:

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 25, 2008 Mar 25, 2008

Copy link to clipboard

Copied

LATEST
If the design based on CSS, there would be a solution also in CSS level.

Such as ...

<link rel="stylesheet" href="styles.css" />
<!--[if lt IE 7]>
<link rel="stylesheet" href="ie7.css" />
<![endif]-->

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation