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

Code structure for include

New Here ,
Aug 03, 2006 Aug 03, 2006

Copy link to clipboard

Copied

Hello
I would like to here from some experts if there would be any problem in using the cfinclude structure in the below mentioned manner.
<cfset sSection = ListGetAt(URL.Action,1,".") />
<cfset sPage = ListGetAt(URL.Action,2,".") />
<cfset sTest = funcGetHtmlPage(trim(sSection),trim(sPage))>

<cfif FileExists(expandpath("#sTest#"))>
<cfsavecontent variable="sPageContent" >
<cfinclude template="#sTest#" >
</cfsavecontent>
<cfinclude template="header.cfm" >
<cfoutput>#sPageContent#</cfoutput>
<cfinclude template="footer.cfm" >
<cfelse>

</cfif>

The reason why I have used this method is that there are many variables in the included main file (derived from "sTest" and then passed on to sPageContent) which has to be set to the header section... some of such variables are...

1. Document Title
2. Page title
3. Functional title
4. Breadcrumps

etc...
Hope this makes the sence..

Can I find someone who has tried with this type of aproach... Can I move one with this... I badly need a expert openion on this and hope I will find it here.

Any openion will be highly appreciated.

Thanks

Shibu Narayanan
TOPICS
Advanced techniques

Views

224

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 ,
Aug 04, 2006 Aug 04, 2006

Copy link to clipboard

Copied

If the variables are set in the header section, you might have some of your code in the wrong order. Did it work when you ran it?

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 ,
Aug 04, 2006 Aug 04, 2006

Copy link to clipboard

Copied

LATEST
Thanks for the reply...
Earlier I too had the feeling that this won't work... but surpricingly it all went in my way... and I still wonder if anything could go wrong in the later phase.. My main concern is about the performance issues....

This is how I need ti working...
The URL will hold the page action which will derive the include file for the particular action.
I need my main page (the dynamic include file) to set some values to the header file ("header.cfm").
If I go for including the files in the conventional order I may have to get some other initializing file included before everything... or some extra code running for that..
No that Im executing my main page first I can have the all my data required for the main file into some variables and then place it on the header file or to any other part of my web page...

It all came to my Idea on seeing the fusebox architecture where I was able to set my header text from any section of the code.. (I havents looked into the fusebox code)...
Would like to know if there is a ny other way if I can do this....

Thanks & Regards
Shibu Narayanan

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