Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
<iw_include> relative pathing
brooke
When using <iw_include> in our TPLs, how can we make the path that is referenced to find the file relative to the generated HTML file?
For example, when using the following syntax:
<iw_include file='images/shared/header.html'/>
the file will be referenced from the images folder directly in our workarea. However, we would like it to read:
<iw_include file='../../images/shared/header.html'/>
As relative to our generated HTML files, this is where the file resides. The iw_include command does not seem to process "../" (relative pathing).
Any thoughts/hints/ideas? Thanks in advance!
Find more posts tagged with
Comments
Migrateduser
Just out of curiosity, why would you want to use a relative path to an include file? Is it different depending on what the page contains (or is located)?
If this is the case, you would keep absolute links (ie. images/shared/header.html) and put some if statements that say if the page is Type 1, take images/shared/header1.html but if it is Type 2 take images/shared/header2.html. Just an idea.
brooke
Hi Trum,
Maybe you can clarify -- here's the directory structure that we have set up:
Development Workarea
- Images
- Shared
- Notifications
- Standard View
Coming from within the Standard View folder, we want to navigate to up and to within the shared folder. If we hardcode the iw_include as "images/shared/header.html" will Interwoven do some sort of manipulation to make it point there? Otherwise, I'm afraid that once we deploy to web the path will be recognized as relative to where we are and become:
Notifications/StandardView/images/shared/header.html
and look for something in:
Notificaitons
- Standard View
- Images
- Shared
rather than the structure that is outlined above.
Does that make sense, or am I way off (it wouldn't be the first time!)? Thanks for your help!
brooke
Oops! The indenting didn't show up in my last post. But I think I may have answered my own question. Does this sound right:
Because we are in TeamSite, and that's where the iw_include files are actually found and embedded in the HTML code, it's okay to code it directly from the workarea (images/shared/header.html) because that is where TeamSite will be looking to find the file (and since TeamSite does the including, it will include it from there).
Does that make any sense at all? Thanks in advance!
Adam Stoller
Have you considered using the 'mode' attribute of iw_include - like mode="docroot" (or one of the others) and making your include path relative to that?
See
http://servername/iw/help/tst/pt/TeamSite__PT__iw_include.html
for more details
--fish
(Interwoven, Curriculum Development)
mogoo
if you start your paths with "/", this basically takes you to the workarea's root level... i.e. <iw_include file='/Images/Shared/header.html'/> will work from any point in the site, as long as you're in the TS structure.
maureen
brooke
Thanks Maureen, that's exactly what I'll be going with!
To piggyback on the question, I reference image files from within the iw_included file (header.html). Will those image files be referenced relative to the header.html file, or relative to the file that is utilizing the header.html file?
I wouldn't think that I could use a direct path from my workarea to reference an image -- or can I??
Thanks once again!
mogoo
By default, if you use "../"'s, it will be relative to header.html. I believe you can change that preference, to make it relative to the parent file utilizing header.html -- but I'm not sure exactly how.
The beauty of starting everything at your workarea root level, though, is that you don't have to worry about all these parent/child file issues. It's cut and dry, always taken from the "top"... if you decided to move header.html to a different dir, the images associated with it will still work.
Just my 2 cents...
brooke
<<again, showing my Interwoven-novice>>
How does TeamSite know to look for the "images" folder at the workarea root, rather than looking within the "shared" folder where the iw_include file is stored(images/shared/header.html)?
In doing some testing to see what works and does not work, I see that if I put "/images/menu.jpg" as the path to an image, it works. However if I put "images/menu.jpg" as the path, it does not find the picture.
Does the "/" before the filename distinguish the path and "mark" it as being from the workarea root?
I'm sure this is very basic, sorry for all of the questions!
Brooke
mogoo
Yes, you've got it, Brooke! By default, the fact that you put a "/" at the beginning of a path always tells TS to start at the workarea root level... otherwise, it is a relative path, and TS will start looking from the dir that your html is in.
maureen
Migrateduser
As a reference or help, here is how we have it set up and it works very well:
/my_workarea_wa
....../folder1
....../folder 2
............/images
....../folder3
(.....'s entered to show formatting)
Every image I put, in a TPL or that I browse to is reference like this <img src="/ folder2 / images / my_image.gif "> (spaces entered for readability) This way, I can put an image on a page within folder1 and have it link correctly.
Also, any link I make is done the same way, with <a href=" / folder1 / my_page.html">
Any link or image source that begins with a / takes it back to the root (just above folder1, folder2, and folder3 in my case).
If you need anymore help just let me know!