Component issues

2008-02-15 Thread Scott Stewart
Hey all, I’m back :-)

 

I’ve got a page set up that seems to be causing component issues.

 

The page is called index.cfm

There’s a header and footer that are called from a Custom tag

Components are called in index,cfm

 

A return variable is needed in the footer from a component called in
index.cfm

 

1)   even with the Custom Tag aren’t the templates processed
sequentially (header, index, footer)

2)   Shouldn’t the return values be in memory and available to any
template?

3)   Why won’t the variable display in the footer.cfm?

 

 

HAAALLPP!!

 

 

-- 

Scott Stewart

ColdFusion Developer

 

SSTWebworks

4405 Oakshyre Way

Raleigh, NC. 27616

(919) 874-6229 (home)

(703) 220-2835 (cell)

 


No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.516 / Virus Database: 269.20.6/1280 - Release Date: 2/15/2008
9:00 AM
 


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:299066
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: Component issues

2008-02-15 Thread Adrian Lynch
It depend whether the custom tag can access the variables. Are you passing
them in? Are they in a scope the custom tag has access to?

Adrian

-Original Message-
From: Scott Stewart
Sent: 15 February 2008 15:26
To: CF-Talk
Subject: Component issues


Hey all, I’m back :-)



I’ve got a page set up that seems to be causing component issues.



The page is called index.cfm

There’s a header and footer that are called from a Custom tag

Components are called in index,cfm



A return variable is needed in the footer from a component called in
index.cfm



1)   even with the Custom Tag aren’t the templates processed
sequentially (header, index, footer)

2)   Shouldn’t the return values be in memory and available to any
template?

3)   Why won’t the variable display in the footer.cfm?





HAAALLPP!!





--

Scott Stewart


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:299067
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Component issues

2008-02-15 Thread Dominic Watson

 Shouldn't the return values be in memory and available to any
 template?


In short, no. In terms of design too, custom tags should be highly
reusable which suggests being self contained which rules out having
dependencies on variables being set elsewhere. Assuming these are your
homemade custom tags, I would added the variables you need as attributes of
the tag and pass them in in the calling page.

As a side note, cfmodule works in the same way and for the same good reason
(self containment and reusability).

HTH

Dominic


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:299080
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: Component issues

2008-02-15 Thread Dave Watts
 I've got a page set up that seems to be causing component issues.
 
 The page is called index.cfm
 There's a header and footer that are called from a Custom tag
 Components are called in index,cfm
 
 A return variable is needed in the footer from a component 
 called in index.cfm
 
 1)   even with the Custom Tag aren't the templates processed
 sequentially (header, index, footer)

Yes.
 
 2)   Shouldn't the return values be in memory and available to any
 template?

Each file - your page, the component, the custom tag - has its own local
scope. If you want to access a variable from within your custom tag, and
that variable is in the page that calls the custom tag, you have three
options:

1. Use the Caller scope to refer to it from within the custom tag. This is
usually not the optimal choice, because it creates a tight coupling between
your page and the custom tag.

2. Pass the value to the custom tag as an attribute. This is usually the
best choice.

3. Place the variable in a scope that's equally accessible from both files.
The Request scope was created explicitly for this purpose. Other choices
include Client, Session, Application and Server scopes. Usually, this is not
as good a choice as passing the value to the custom tag, but since custom
tags can't really return values without a hack of sorts, the Request scope
can be very convenient if you have multiple levels of nesting.

 3)   Why won't the variable display in the footer.cfm?

Because it's not in a scope that both files can see the same way.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/

Fig Leaf Training: Adobe/Google/Paperthin Certified Partners
http://training.figleaf.com/

WebManiacs 2008: the ultimate conference for CF/Flex/AIR developers!
http://www.webmaniacsconference.com/

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:299079
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4