Coast Line
asked on
prefex tags with Coldfusion
Hi i am using an application where somethings are defined using <cfimport tag to use to make things simple. but to me it created a problem:
here is the lines that troubles me:
here is the lines that troubles me:
<cfoutput>
<tags:surveydisplay survey="#survey#" />
<cfelseif not structKeyExists(variables, "template")>
<!--- Loads header --->
<tags:layout templatename="main" title="Survey: #survey.name#">
<tags:surveydisplay survey="#survey#"/>
</tags:layout>
<cfelse>
<tags:surveydisplay survey="#survey#" />
surveydisplay is the page where this is defined:
<cfparam name="attributes.survey">
<cfset surveyComplete = false>
<cfif not structKeyExists(session,"surveys")>
<cfset session.surveys = structNew()>
</cfif>
for the above i just removed the cfimport tag and tried something this:
<cfinclude template="surveydisplay.cfm">
but it give this error:
he following information is meant for the website developer for debugging purposes.
Error Occurred While Processing Request
The required parameter ATTRIBUTES.SURVEY was not provided.
This page uses the cfparam tag to declare the parameter ATTRIBUTES.SURVEY as required for this template. The parameter is not available. Ensure that you have passed or initialized the parameter correctly. To set a default value for the parameter, use the default attribute of the cfparam tag.
The error occurred in C:\Inetpub\wwwroot\surveydisplay.cfm: line 1
1 : <cfsetting enablecfoutputonly=true>
2 : <cfdump var="#session#">
3 : <cfparam name="attributes.survey">
ASKER
yes they are really custom tags:
my just cfinclude cannot work here.
Ok:
first i start with the layout Tag:
Here below its code:
after that it is calling the surveydisplay tag like this:
<cfinvoke component="admin.cfc.auth" method="getSurvey" id="#trim(url.id)#" returnvariable="survey"/>
<cfif survey.active IS 1 or survey.showThis EQ 'Yes'>
<cfdump var="#survey#"><cfabort>i dumped it and i get query results: as:
the file is attached.
now this below thing is calling the surveydisplay which have a record:
my just cfinclude cannot work here.
Ok:
first i start with the layout Tag:
Here below its code:
after that it is calling the surveydisplay tag like this:
<cfinvoke component="admin.cfc.auth"
<cfif survey.active IS 1 or survey.showThis EQ 'Yes'>
<cfdump var="#survey#"><cfabort>i dumped it and i get query results: as:
the file is attached.
now this below thing is calling the surveydisplay which have a record:
<
tags:layout
templatename
=
"main"
title
=
"Survey: #survey.name#"
>
<
tags:surveydisplay
survey
=
"#survey#"
/>
</
tags:layout
>
<
cfelse
>
<
tags:surveydisplay
survey
=
"#survey#"
/>
surveydisplay page is something like this:
<cfparam name="attributes.survey">
<cfset surveyComplete = false>
<!--- Initialize in session scope if it doesn't exist --->
<cfif not structKeyExists(session,"surveys")>
<cfset session.surveys = structNew()>
</cfif>
<!--- Initialize certain values in the session struct --->
<cfif not structKeyExists(session.surveys,attributes.survey.id)>
<cfset session.surveys[attributes.survey.id] = structNew()>
<cfset session.surveys[attributes.survey.id].currentStep = 1>
<cfset session.surveys[attributes.survey.id].answers = arrayNew(1)>
<cfset session.surveys[attributes.survey.id].maxQuestions = application.question.getQuestions(attributes.survey.id).recordCount>
</cfif>
So i am here how removal of tags: custom tags to make the page simple will work though<cfif isDefined("attributes.templatename")>
<cfset attributes.template = attributes.templatename>
</cfif>
<cfparam name="attributes.template">
<cfparam name="attributes.title" default="">
<cfparam name="attributes.loadspry" default="false">
<cfset base = "../pagetemplates/" & attributes.template>
<cfif thisTag.executionMode is "start">
<cfset myFile = base & "_header.cfm">
<cfelse>
<cfset myFile = base & "_footer.cfm">
</cfif>
<cfinclude template="#myFile#">
<cfsetting enablecfoutputonly=false>
www.bmp
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Anyways, This is not a solution but here one thing i understood that Custom tags have some value which play an important role
@myselfrandhawa:
if you have actually stated your problem, we might have provided detailed help.
but the way your 'questions' were phrased, i failed to understand what your actual problem was... i have even asked twice in my replies for you to clarify this.
please do not take this as a rant or a negative comment towards you - i am just trying explain why it was impossible to provide a solution to your 'problem' and to help you get better expert help and solutions in the future.
phrases like "here is the lines that troubles me" and "" are very moot do not describe a problem in any way that can help us to help you.
try to be as specific as you can when describing a problem:
explain what the code does and how it is different what you expected it to do;
copy and paste exact cf errors you get, if any;
state your questions as questions: "What does <cfimport> tag do in my attached code, why do i need it there and what do i need to change in my code if i want to remove it?" is a question, "am using an application where somethings are defined using <cfimport tag to use to make things simple. but to me it created a problem" is NOT;
when posting code, try and make it as 'executable' as possible - so a test case of your problem can easily be re-created by experts who are trying to help you out; at the very least, make sure the code is structurally correct (no missing opening/closing cf tags, any referenced UDFs/CFCs are posted as well, comment code lines where necessary) and does not include irrelevant html/styling.
once again, this open discussion post is aimed to help you get better help with your problems next time. hope you understand!
cheers,
Azadi
if you have actually stated your problem, we might have provided detailed help.
but the way your 'questions' were phrased, i failed to understand what your actual problem was... i have even asked twice in my replies for you to clarify this.
please do not take this as a rant or a negative comment towards you - i am just trying explain why it was impossible to provide a solution to your 'problem' and to help you get better expert help and solutions in the future.
phrases like "here is the lines that troubles me" and "" are very moot do not describe a problem in any way that can help us to help you.
try to be as specific as you can when describing a problem:
explain what the code does and how it is different what you expected it to do;
copy and paste exact cf errors you get, if any;
state your questions as questions: "What does <cfimport> tag do in my attached code, why do i need it there and what do i need to change in my code if i want to remove it?" is a question, "am using an application where somethings are defined using <cfimport tag to use to make things simple. but to me it created a problem" is NOT;
when posting code, try and make it as 'executable' as possible - so a test case of your problem can easily be re-created by experts who are trying to help you out; at the very least, make sure the code is structurally correct (no missing opening/closing cf tags, any referenced UDFs/CFCs are posted as well, comment code lines where necessary) and does not include irrelevant html/styling.
once again, this open discussion post is aimed to help you get better help with your problems next time. hope you understand!
cheers,
Azadi
you can't just <cfinclude> them.
what exactly is the problem you are having? you have not really explained it...
Azadi