Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing a Paramater

Status
Not open for further replies.

mikeadmin

MIS
Oct 22, 2001
38
0
0
US
Hi,
I am unable to pass a parameter :
#TransferTicket.TransferTicketID# to a another cfm page.
I am able to see the output:
<CFOUTPUT> Testing the ticket #TransferTicket.TransferTicketID#</CFOUTPUT>
This works so I know that the parameter is correct.
I get a the following error:
Template file not found.

HTTP/1.0 404 Object Not Found
Note: If you wish to use an absolute template path (e.g. TEMPLATE=&quot;/mypath/index.cfm&quot;) with CFINCLUDE then you must create a mapping for the path using the Cold Fusion Administrator.

However, my mappings are fine because I use them all over my site.
Does anyone have any idea what it can be?
Thanks

 
try removing the first folder from the path of the template you are including:

if you use this:

<cfinclude template=&quot;includes/incl.cfm&quot;>

try this:

<cfinclude template=&quot;incl.cfm&quot;> Sylvano
dsylvano@hotmail.com
 
Hi Sylvano,
Thanks for the advice but that didnt work. I even tried pointing directly to file to no success.

Mike
 
if you are positive that paths are ok, check the file name and make sure there is no spelling error (that had happen to me more than once...)

I mean, 404 error is because cf is unable to find the file, and that can because the path is wrong or misspelled. Sylvano
dsylvano@hotmail.com
 
Still no luck, can I create individual paths :
eg.
logical Path \programmermapDirectory Path c:\pdc\pdc\admin\programmer
FOR THIS

<CFINCLUDE TEMPLATE=&quot;/programmermap/sendTransferTicket
ReissuedNotification.cfm?
TransferTicketID=#TransferTicket.TransferTicketID#&quot;>
 
<CFINCLUDE> doesn't take arguments to pass. Also, the script shown above uses &quot;absolute&quot; paths, which cannot be done unless ColdFusion mapping has been specified in CF Server Admin.

If you use <CFINCLUDE> all the variables defined in the current page before the this tag is called is available to the included file. To pass parameters use <CFMODULE> using the ATTRIBUTES scope. See 2 examples below.

EXAMPLE 1

=== START CODE EXAMPLE ===
[COLOR=666666]<!--- Script1.cfm --->[/color]
<CFSET TransferTicket.TransferTicketID = 100>
<CFINCLUDE TEMPLATE=&quot;../script2.cfm&quot;>
=== END CODE EXAMPLE ===

=== START CODE EXAMPLE ===
[COLOR=666666]<!--- Script2.cfm --->[/color]
<CFOUTPUT>
#TransferTicket.TransferTicketID#
</CFOUTPUT>
=== END CODE EXAMPLE ===


EXAMPLE 2

=== START CODE EXAMPLE ===
[COLOR=666666]<!--- Script1.cfm --->[/color]
<CFSET TransferTicket.TransferTicketID = 100>
<CFMODULE TEMPLATE=&quot;../script2.cfm&quot; TTID=#TransferTicket.TransferTicketID#>
=== END CODE EXAMPLE ===

=== START CODE EXAMPLE ===
[COLOR=666666]<!--- Script2.cfm --->[/color]
<CFOUTPUT>
#ATTRIBUTES.TTID#
</CFOUTPUT>
=== END CODE EXAMPLE === - tleish
 
Thanks Tleish,
I wont be back in the office until the 12/31 so I'll let you know how it works out. Thanks
 
Hi Tleish,
Are you defining the transferticket at 100?
<CFSET TransferTicket.TransferTicketID = 100>

Might help if I tell you alittle more. I user will enter item # from another page which sends to the page i'm working on. It sends the input and names it &quot;ItemIDList&quot;. The current page will have to do some checking and then use this item # to open a template. Here are the two main templates.
<!--- alert the proper people --->
<CFLOOP QUERY=&quot;TransferTicket&quot;>
<!--- see if the ticket will be voided or reissued (if it will still have items) --->
<CFQUERY NAME=&quot;UpdatedTransferRequest&quot; DATASOURCE=&quot;PDC&quot;>
SELECT ItemID FROM TransferRequest WHERE TransferTicketID = #TransferTicket.TransferTicketID#
AND ItemID NOT IN (#ItemIDList#)
</CFQUERY>

<!--- if it will be reissued --->
<CFIF #UpdatedTransferRequest.RecordCount# GT 0>
<CFINCLUDE TEMPLATE=&quot;sendTransferTicketReissuedNotification.cfm?
TransferTicketID=#TransferTicket.TransferTicketID#&quot;>
<!--- if it will be voided --->
<CFELSE>
<CFINCLUDE TEMPLATE=&quot;sendTransferTicketVoidedNotification.cfm?
TransferTicketID=#TransferTicket.TransferTicketID#&quot;>
</CFIF>
</CFLOOP>

AND:
<!--- send out the reissued transfer tickets --->
<CFLOOP QUERY=&quot;TransferTicket&quot;>
<!--- see if the ticket has been voided or reissued --->
<CFQUERY NAME=&quot;UpdatedTransferTicket&quot; DATASOURCE=&quot;PDC&quot;>
SELECT ItemID FROM TransferRequest WHERE TransferTicketID = #TransferTicket.TransferTicketID#
</CFQUERY>

<!--- if it has been reissued (if it still has items) --->
<CFIF #UpdatedTransferRequest.RecordCount# GT 0>
<!--- send out the updated transfer ticket --->
<CFINCLUDE TEMPLATE=&quot;sendTransferTicketNotification.cfm?
TransferTicketID=#TransferTicket.TransferTicketID#&quot;>

<CFOUTPUT>
Reissued transfer ticket <A HREF=&quot;transferTicket.cfm?TransferTicketID=
#TransferTicket.TransferTicketID#&quot;>#TransferTicket.TransferTicketID#</A>.
<BR>
</CFOUTPUT>
 
I think I am getting closer. When I execute the page I get this error message:

Cannot find CFML template for module sendTransferTicketVoidedNotification.cfm?TransferTicketID=2439

However it works if I manual type the link in:

I have tried all different ways of setting up paths but cannot get it to work.

Per your suggestions this is the adjusted code:
<CFMODULE TEMPLATE=&quot;sendTransferTicketNotification.cfm?TransferTicketID=#TransferTicket.TransferTicketID#&quot;
TTID=#TransferTicket.TransferTicketID#>

<CFOUTPUT>
Reissued transfer ticket <A HREF=&quot;transferTicket.cfm?TransferTicketID=#ATTRIBUTES.TTID#&quot;>#ATTRIBUTES.TTID#
 
the point tleish is trying to make here is that when cfinclude is used, you don't have to pass any parameters to the included template; the included template will behave as the part of the main template, but the variables have to be defined prior to the including template; so, the syntax in your case will be:

<!--- if it has been reissued (if it still has items) --->
<CFIF #UpdatedTransferRequest.RecordCount# GT 0>
<!--- send out the updated transfer ticket --->
<CFINCLUDE TEMPLATE=&quot;sendTransferTicketNotification.cfm&quot;>...

and in the included template you can access the TransferTicketID simply by calling it;

when cfmodule is used, you are using the following syntax:

<CF_sendTransferTicketNotification
TransferTicketID=#TransferTicket.TransferTicketID#
TTID=#TransferTicket.TransferTicketID#>

the sendTransferTicketNotification.cfm template should be in the same folder it is being called from; to access resulting variables in the main template, the variable in the module document should be scoped with caller prefix. e.g.:

cfset caller.varName = whatever



Sylvano
dsylvano@hotmail.com
 
If:

Code:
[URL unfurl="true"]http://10.26.0.57/PDC/Admin/Programmer/sendTransferTicketVoidedNotification.cfm[/URL]

Is the path of sendTransferTicketVoidedNotification.cfm

Then what is the path of the page that's calling the template as a module:

<CFMODULE TEMPLATE=&quot;sendTransferTicketNotification.cfm?TransferTicketID&quot;...>
- tleish
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top