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)
iwpt_get_flag_param ?
nipper
Saw this in a templating WP, but cannot find any docs anyone have any docs on this ?
nothing in perldoc
Trying to get the name of a DCT within the TPL.
Looking for ideas.
Andy
Find more posts tagged with
Comments
Migrateduser
Check extended attributes on the DCR.
nipper
Sorry I meant the DCR name, not the DCT name. Did get it with this:
<iw_perl>
<![CDATA[
$dcr = TeamSite:
T::iw_xml::get_flag_param($iw_parser,'-iw_pt-dcr');
iwpt_output($dcr);
]]> </iw_perl>
it is just so intutitive, it is a wonder I had any trouble at all. :-)
BTW, found it with grep through the perl modules.
Andy
mogoo
how about...
iwpt_get_dcr_name(); #entire file path (from /iwmnt)
iwpt_get_dcr_name('dirname'); #directory portion of dcr path
iwpt_get_dcr_name('basename'); #only dcr file name
Adam Stoller
Gee - I would have simply use
iwpt_get_dcr_name()
- which you could have found in the on-line docs:
servername>http://
servername
/iw/help/tst/pt
/TeamSite__PT__iw_perl.html
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
nipper
Thanks Maureen
I will try them.
Andy
DavidMusser
I'm using
my $FileName = iwpt_get_dcr_name('basename'); and it's giving me only the first name that I pass into the iw_pt compile.. Any ideas from anyone? How do I get the second dcr's name?
I am able to loop through multiple dcr's values ok, but I can only get the first filename.
David R Musser
Eye Street Software
540-542-5257
dmusser@eyestreet.com
Win2k, TS 6.5 SP1, OD 6.01
Migrateduser
I believe iwpt_get_dcr_name is
supposed
to return only one result. In this case, I wonder if you could have a statement in your PT to read the incoming iwpt_compile command (with all arguments, etc.) and parse through to capture the other DCR's. This is theoretical, but it seems reasonable.
Dave
Current Environment(s):
(1) TS 6.5 on W2K3
(2) TS 6.1 SP1 on W2K3
By the way, I miss Unix terribly.
DavidMusser
Bummer... so much for doing it that way... Just trying to create an index script :-) So now I either have to read the directory in the .tpl or put the attributes in the dcr's themselves... bummer :-(
David R Musser
Eye Street Software
540-542-5257
dmusser@eyestreet.com
Win2k, TS 6.5 SP1, OD 6.01
Migrateduser
I'm not
positive
about what I wrote, though -- just 90% sure. The only reason I decided to respond was that it had been a few hours and no one else had.
On the other hand, I wonder how it would behave if you were to declare the value as an array, say
@FileName
= iwpt_get_dcr_name('basename') Worth a shot?
Dave
Current Environment(s):
(1) TS 6.5 on W2K3
(2) TS 6.1 SP1 on W2K3
By the way, I miss Unix terribly.
DavidMusser
I think you are right. I've tried it several ways and I can't get it to give me the next value. I'm debating on storing the filename with the dcr, or to have the pt read the directory and only send it one dcr... anyway thanks again!
David R Musser
Eye Street Software
540-542-5257
dmusser@eyestreet.com
Win2k, TS 6.5 SP1, OD 6.01
Migrateduser
Have you tried using iwpt_get_flag_param() ?
Current Environment(s):
(1) TS 6.5 on W2K3
(2) TS 6.1 SP1 on W2K3
By the way, I miss Unix terribly.
DavidMusser
No, but wouldn't that just get me the arguments passed into the tpl? what I was doing was basically the tutorial 3 example where it does the index (like) page, but I wanted to use the filename to base the index off of... we save some things as xxxx_010105 so it would have been easy to use the dcr name and just apply the html extension...
As it is I ended up doing this... it's a modification to an old post. I now just send in one file and get my naming pattern... i.e. this index is for this month, so I don't want last month's etc, but I also don't want to get into using multiple directories in the data dir... so I get the pattern, and the do a directory listing in the tpl.
<iw_perl><![CDATA[
my $iw_file = iwpt_get_dcr_name('basename');
$pre_pattern = substr( $iw_file, 3, 2 ); # "is"
$post_pattern = substr( $iw_file, 7, 2 ); # "is"
$dir = "y:/default/main/internet/STAGING/templatedata/internet/foo/data";
opendir(DIR, $dir);
@f
= readdir(DIR);
closedir(DIR);
foreach $x (reverse sort
@f)
{
if($x !~ m|^\.|)
{
if ( ( $pre_pattern eq substr( $x, 3, 2 ) ) && ( $post_pattern eq substr( $x, 7, 2 ) ) )
{
$root = iwpt_load_dcr("$x","dcrlocal","t");
$date = iwpt_dcr_value('$root.foo.general.Date') ;
iwpt_output("<tr> <td>- </td>");
iwpt_output("<td><a href=\"/foo/2005/$x.shtm\">$date</a></td>");
iwpt_output("</tr>");
}
}
}
Kinda dirty, but it works.
David R Musser
Eye Street Software
540-542-5257
dmusser@eyestreet.com
Win2k, TS 6.5 SP1, OD 6.01