Georg
|
| Posted: 11/17/2004, 10:31 AM |
|
Noticing something strange,
Have a common page that works fine on all the pages in the root directory. Once I however want to make use of this page on another page that is lower doen the structure the page is loaded but the picture links are not correct.
The includable page now loads from ../include.php and the pictures are trying to load from currentfolder/images instead of ../images.
Any Ideas on how to fix this ?
Thanks
|
|
|
 |
DonB
|
| Posted: 11/17/2004, 6:48 PM |
|
I've always just fixed up the path in the Before Show event of the Image
control. It's definitely annoying that the Includes don't acquire the
"relative path" of their parent. Seems wrong that it works that way since
the Include is most useful when it's serves as a reusable component in
multiple places of your application.. But it only works right out of the
box if everything is put in one folder. Yyou have to add code to repair the
paths when used in different folders.
The same problem will crop up with Links or Buttons on the Include page,
too.
--
DonB
http://www.gotodon.com/ccbth
|
|
|
 |
Don Safar
|
| Posted: 11/17/2004, 8:45 PM |
|
Do you know if this has been submitted to the wishes forum? I searched and didn't see it.
|
|
|
 |
Georg
|
| Posted: 11/18/2004, 1:34 AM |
|
DonB, have you got a sample code of what you use for me?
Thanks
|
|
|
 |
DonB
|
| Posted: 11/18/2004, 5:31 AM |
|
Don, I can't recall if I put it there, but in the past I've submitted it
directly via the support page as a suggestion/problem statement.
--
DonB
http://www.gotodon.com/ccbth
|
|
|
 |
DonB
|
| Posted: 11/18/2004, 5:47 AM |
|
(Before Show event for Link or ImageLink)
ASP:
With Eventcaller
.Link = ServerURL & .Link
End With
PHP:
$mylink->SetLink(ServerURL . $mylink->GetLink());
For buttons in PHP, it seems to work well to put "$FileName" (without the
quotes) into the Return Page property. So if there's a form in the Include
page, it targets the main page.
You can't do it that way in ASP because $FileName is evaluated within a
quoted string by PHP, but not by ASP. So doing this with ASP means you end
up setting the Return Page to, literally, $-F-i-l-e-N-a-m-e (variables are
not evaluated within a string by ASP). If this sounds confusing, just try
it and look at what code gets generated. In some projects, things worked
out so that I could leave the Return Page blank in the ASP Includes. I
think I used "." once. That was pre-V2.3 - which did alter the way includes
work slightly.
The whole idea is simply to prefix the relative url I put in the link at
design time, adding the global "constant" that CCS implements for the
Project Property (under "Publishing" tab as "Live Site URL"). This makes
it an absolute URL and the code does not touch it.
--
DonB
http://www.gotodon.com/ccbth
|
|
|
 |
Georg
|
| Posted: 11/18/2004, 12:06 PM |
|
Brillinat. Thanks
|
|
|
 |
|