One problem I can see with this approach is created because of the way I
set up my files.  A page and its accompanying individual js and css files
(no, I don't create a single monster js or css file, but rather many
smaller ones inside "module" folders that contain the .cfm, .cfc, .css,
and .js specific to a particular module.  There are *many* more files that
way, but I don't find the increased number of http requests to be a problem.
I do it this way to help me keep my sanity when trying to manage so much
code.

And for a more "down-to-earth" question... what if the <title> of a page
was different for every page?  Even if everything else was the same for
each page (all links, etc.), how would you use a variable to create
different titles for all the pages?

Maybe I'm just having a brain cramp and can't see the forest for the
trees...



-----Original Message-----
From: Matt Quackenbush [mailto:quackfu...@gmail.com] 
Sent: Tuesday, May 22, 2012 6:37 PM
To: cf-talk
Subject: Re: How to prevent cfhtmlhead content from being inserted into
cfmail...


It would be much better to use an include for your HTML <head> (in your
layout template) than to use cfhtmlhead in the app CFC.  Also, there is no
reason to set all of those 'js_whatever' variables. Just output
#application.whatever# in the js. Your include file might look something
like so:

<head>
    <!-- all of your standard css/js links, scripts, etc., including the js
you've just shown -->
    <title>bla bla</title>
</head>

So each page (or layout) simply does a <cfinclude
tempate="/includes/html_head.cfm" />.

HTH

On Tue, May 22, 2012 at 5:28 PM, Rick Faircloth
<r...@whitestonemedia.com>wrote:

>
> I need variables like these (these are just part of the variables)
> on every page of the site, useable as CF and JS variables:
>
> <cfsavecontent variable = "jsVariables">
>
>   <!--- [ js version of cf variables ] --->
>
>   <cfset  js_sitename             =     application.sitename          />
>   <cfset  js_website              =     application.website           />
>   <cfset  js_site_manager_dsn     =     application.site_manager_dsn  />
>   <cfset  js_client_dsn           =     application.client_dsn        />
>
>   <cfoutput>
>
>      <script type="text/javascript">
>
>         var  js_sitename          =    '#js_sitename#';
>         var  js_website           =    '#js_website#';
>         var  js_site_manager_dsn  =    '#js_site_manager_dsn#';
>         var  js_client_dsn        =    '#js_client_dsn#';
>
>      </script>
>
>   </cfoutput>
>
> </cfsavecontent>
>
> <cfhtmlhead text = "#jsVariables#" />
>
>
> Why would putting this code directly in the head of each page
> be better than using cfhtmlhead?
>
>
>
> -----Original Message-----
> From: Andrew Scott [mailto:andr...@andyscott.id.au]
> Sent: Tuesday, May 22, 2012 4:19 PM
> To: cf-talk
> Subject: Re: How to prevent cfhtmlhead content from being inserted into
> cfmail...
>
>
> Rick that might be a good case to think about the application, and one
> reason why you need to keep things out of the Application.cfc that really
> don't need to be there.
>
> If you must continue with it, then you might need to look for a
conditional
> statement to not include the JS etc for the CFHTMLHEAD, but on the other
> side of your question you can use cfsavecontent to create a variable and
> use that with CFHTMLHEAD.
>
> --
> Regards,
> Andrew Scott
> WebSite: http://www.andyscott.id.au/
> Google+: http://plus.google.com/108193156965451149543
>
>
>
> On Wed, May 23, 2012 at 4:26 AM, Rick Faircloth
> <r...@whitestonemedia.com>wrote:
>
> >
> > Hi, all...
> >
> > I've got a cfhtmlhead tag set up in my application CFC that
> > defines some JS variables for CF use and vice-versa. They're inserted
> into
> > the
> > head of every page.
> >
> > I noticed, when running an sequence involving an HTML form - jQuery ajax
> > call -
> > CFC method - and JSON data return, that the JS variables are being
> inserted
> > into the JSON return data from the ajax call. This is throwing off my
> > "success" processing after the call.
> >
> > Is there any way to prevent the JS being output using cfsavecontent and
a
> > variable
> > in the CFC from ending up in the JSON data return? The CFMAIL is
> processed
> > fine
> > and the mail goes out, but the extra data beyond "success" in the JSON
is
> > preventing
> > and further JS statement from processing...basically, the
"Processing..."
> > message
> > isn't being hidden and the "Thank You" message isn't being shown after
> the
> > form
> > is processed and the mail is sent.
> >
> > I didn't want to get into all the code up front in case there's a simple
> > way
> > to handle this.
> >
> > Thanks for any feedback!  If you need to see some code, let me know!
> >
> > Rick
> >
> >
> >
> >
>
>
>
> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351294
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to