Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Getting Generated Path from Presentation Template
mcastleberry
Is there a way I can get the path of the file that is getting generated from inside the Presentation Template?
Find more posts tagged with
Comments
mogoo
This might be what you're looking for. It's from the Templating Developer's Guide, in the <iw_perl> section...
iwpt_get_ofile_name()
iwpt_get_ofile_name($part)
Gets the name of the file that iwpt_compile.ipl will output.
If $part is undefined, the entire file name is returned.
If $part is 'dirname', the directory portion of the name is returned.
If $part is 'basename', the file name (minus the dirname) is returned.
Capture.PNG
Migrateduser
Yes. Go to
http://localhost/iw/help/tst/PT/TeamSite__PT__iw_perl.html
on your teamsite server and read about iwpt_get_ofile_name().
bw
Bob Walden [bob.walden@interwoven.com]
Interwoven Education Group
IM: Yahoo, MSN bob_walden
mcastleberry
That gives me the absolute path, can I get the relative path?
Thanks!
akshathp
One way to do that would be to read HTTP_COOKIE and get workarea path from it. Then you could use regex to remove this workarea path from the absolute path you get from those iwpt functions.
Hope this helps!
Akshat Pramod Sharma
Interwoven Inc.
SAP_Scrip_RDI_Preview_Solution_for_StreamServe.pdf
Migrateduser
THe answer is "yes", but the details depend on what directory you want the path to be relative to. If relative to the root of the WA, I'd use a regex:
==========================
$file = iwpt_get_ofile_name();
$file =~ s|.+/WORKAREA/[^/]+/(.+)|$1|;
==========================
should do it.
bw
Bob Walden [bob.walden@interwoven.com]
Interwoven Education Group
IM: Yahoo, MSN bob_walden
james1
You can probably use the iwvpath CLT to get the pieces of the path that you want.
-- James
--
James H Koh
Interwoven Engineering
james1
How do you get the values of cookies from within a PT? Especially when the PT was invoked from the command line?
-- James
--
James H Koh
Interwoven Engineering
mcastleberry
Unfortunatly that did not work. Here's what I got:
$ofile = TeamSite:
T::iw_xml::get_ofile_name($iw_parser);
$ofile =~ s|.+\WORKAREA\[^\]+\(.+)|$1|;
It starts as Y:\default\main\APQC\WORKAREA\WA1\site\linktest.jhtml and still results as the same.
What I want from that path is "/site/linktest.jhtml".
thanks!
mcastleberry
What do you mean by iwvpath CLT ?
I've tried using this:
$ofile = TeamSite:
T::iw_xml::get_ofile_name($iw_parser);
$otest = TeamSite:
T::iw_xml::get_virtual_path('', $ofile, 'docroot');
but I could never get that to work, trying every possible combination of locations and modes.
Thanks!
akshathp
iwvpath Command Line Tools sure sounds like a very good idea.
It has a switch *-d* which can fetch jsut the directory path. That should work. You could refer to Command Line Tools guide for more details on syntax.
Yeha, I realise now that you are trying a Command line approach hence HTTP_COOKIE is not going to work. Sorry about the previous idea. But this iwvpath should work.
Hope this helps!
Akshat Pramod Sharma
Interwoven Inc.
james1
You probably need to escape the back-slashes in your regular expression.
Since you say you want forward slashes in your result anyway, I would recommend just changing the slashes first, and then applying your regular expression, e.g.:
$ofile = TeamSite:
T::iw_xml::get_ofile_name($iw_parser);
$ofile =~ s|\\|/|g;
$ofile =~ s|.+/WORKAREA/[^/]+/(.+)|$1|;
Hope this helps.
-- James
--
James H Koh
Interwoven Engineering
james1
By "iwvpath CLT" I mean "invoke the iwvpath CLT to get the string that you want, given the string that you have".
Something like:
$ofile = TeamSite:
T::iw_xml::get_ofile_name($iw_parser);
my $iwvpath_result = `$IWHOME/bin/iwvpath -d \"$ofile\"`;
chomp $iwvpath_result;
"$iwvpath_result" should now be the string you want. It might begin with a leading slash though, but you can take it off:
s|^/||;
Hope this helps.
-- James
--
James H Koh
Interwoven Engineering
Migrateduser
Maybe I got it wrong, but why do not do a substring search Of WORKAREA , you got the index and add 9 (length of WORKAREA/ word) ok, now you have:
WHATEVER/site/yourpage.html
now, do a search of the first '/' (slash) starting from the left,
now you have
/site/yourpage.html
seems a case of simple logic.. but then again, I might be getting the point wrong...