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

CFLOCATION and Directory level

Explorer ,
Dec 01, 2006 Dec 01, 2006

Copy link to clipboard

Copied

Hi, I have a cfm page that has a flash movie inside it.

In the flash movie I use GETURL to redirect to another cfm page which i'll call page2 for this explanation. Inside page2 I have a cflocation tag that finds a cfm page two levels up the directory chain and I'll call this page page3. The code I us to go up 2 levels is ‘../../page3.cfm’ but the error I get back from CF is that CF trying to find page3 in the same directory as page2.

Can anybody give me a pointer on why and how to solve this.

Thanks in advance for any help.

Cheers Simon
TOPICS
Advanced techniques

Views

2.1K

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 ,
Dec 01, 2006 Dec 01, 2006

Copy link to clipboard

Copied

If relative addressing does not work, try absolute addressing.

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 ,
Dec 01, 2006 Dec 01, 2006

Copy link to clipboard

Copied

Agreed. Start from the root and you can't go wrong with that.

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
Participant ,
Dec 01, 2006 Dec 01, 2006

Copy link to clipboard

Copied

I like to set an application variable in my application file and just set everything "absolutely" from there.

application.ServerRoot = "#Replace(GetCurrentTemplatePath(), "/Application.cfm", "", "all")#";

it works quite nicely.

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
LEGEND ,
Dec 01, 2006 Dec 01, 2006

Copy link to clipboard

Copied

Bare in mind that the URL in the <cflocation> tag is relative to the URL of
the request (and each relocate is a new request), and does not -
necessarily - have any bearing on the relative filesystem paths between the
file with the <cflocation> tag in it and the target of the <cflocation>
tag.

It doesn't sound - from your description - that this is your problem, but
it's worth being mindful of.

Why are you bouncing "through" page2.cfm, only to end up going to page3.cfm
instead?

--
Adam

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
Community Expert ,
Dec 02, 2006 Dec 02, 2006

Copy link to clipboard

Copied

What you wish to achieve should be possible if your code and path structure is something like

code <cflocation url="page2.cfm"> in
C:\CFusionMX7\wwwroot\dir1\dir2\pageContainingFlashMovie.cfm

code <cflocation url="../../page3.cfm"> in
C:\CFusionMX7\wwwroot\dir1\dir2\page2.cfm

C:\CFusionMX7\wwwroot\page3.cfm

However, if instead you have

C:\CFusionMX7\wwwroot\pageContainingFlashMovie.cfm
C:\CFusionMX7\wwwroot\page2.cfm
C:\CFusionMX7\wwwroot\dir1\dir2\page3.cfm

then the code you should use in page2.cfm to redirect to page3.cfm is
<cflocation url="dir1/dir2/page3.cfm



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
Explorer ,
Dec 05, 2006 Dec 05, 2006

Copy link to clipboard

Copied

Thanks for all your replys,

Dan and CF_N_Montreal I’ve done that and that seemed to work.

Sean69, I have used GetCurrentTemplate and other Directory code in the past. I think I should continue using this where I can.

Adam, the reason I’m bouncing through page2 is that it has a standard routine in it. I could or should use cfIncluded maybe. This might work better I don’t know.

BKBK, Correct - I thought it should work this way and this is why I continued in trying to find out the problem.

I don’t know if this has any bearing on my problem but I had a missing DOCTYPE tag in my page. I put one in and the page worked!?!?

I will keep mypath ../../ for the moment, but once I get even one error page come through I’ll switch to one of the methods mentioned in this thread.

Cheers.

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
LEGEND ,
Dec 06, 2006 Dec 06, 2006

Copy link to clipboard

Copied

LATEST
> Adam, the reason I?m bouncing through page2 is that it has a standard routine
> in it. I could or should use cfIncluded maybe. This might work better I don?t
> know.

<cflocation> does another trip back to the client browser, which you almost
certainly don't want. It's NOT a form of "goto" statement (and if it was,
you still shouldn't be using it in this case ;-), nor is it a way of
including code. So, yes, you should be using <cfinclude> or <cfmodule> or
something like that instead.

--
Adam

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