Is there a way to unload DCR's? I am wanting to unload the initial DCR that gets added during pt compile (dcr[0]).
ok. I think you are right that I can just ignore that DCR. If I am using a foreach loop to interate thru the dcr's that I have loaded, how do I ignore dcr[0]? I guess what I do not understand is how to reference "dcr".ex. of what I am after:foreach $index (iwpt_dcr_list = 'dcr') if not dcr[0] then { do stuff}Thanks for the help
iwpt_dcr_list = 'dcr'
@dcrs
foreach my $dcr (@dcrs){ next if ($dcr eq $dcrs[0]); my $cur_dcr = iwpt_load_dcr($dcr); ...}
shift @dcrs; # remove the first entryforeach my $dcr (@dcrs){ ...}
Here is the exact code I use to interate through all the DCR I loaded:foreach my $index ( iwpt_dcr_list( 'dcr' ) )
Here is the exact code I use to interate through all the DCR I loaded:foreach my $index ( iwpt_dcr_list( 'dcr' ) ) <iw_iterate var='index' list='dcr' iteration = "i">
I would always want to remove dcr[0]. So it appears 'dcr' is a reserved variable, but I am not so sure this is an array? I am calling iwpt compile from a workflow and use the attached .dcr for the intial .dcr when calling iwpt compile. Is this required? if so, I would always want to remove dcr[0] and load all dcr's manually. But 'dcr' appears to be a pointer and not an accessible array.
my @dcr_names = iwpt_get_dcr_name(); # Array of DCR Namesmy @dcr_list = iwpt_dcr_list('dcr'); # Array of *parsed DCRs*if (@dcr_list) { # All right, we have something foreach my $current_dcr (@dcr_list) { my $current_dcr_name = shift @dcr_names; # Use current_dcr as you would normally use 'dcr' my $something = iwpt_dcr_value('current_dcr.blah') }}
my @full_dcr_names ;# build an array @full_dcr_names of DCR Pathes you want...my @dcr_names = iwpt_get_dcr_name(); foreach my $nextdcr (@full_dcr_names) { my $lookup = $nextdcr; $lookup =~ s|\\|/|g; $lookup =~ s|.*/([^/]+)$|$1|; push (@dcr_names, $lookup); iwpt_load_dcr($nextdcr, 'dcrlocal', 't');}my @dcr_list = iwpt_dcr_list('dcr'); # Array of *parsed DCRs*if (@dcr_list) { # All right, we have something foreach my $current_dcr (@dcr_list) { my $current_dcr_name = shift @dcr_names; # Use current_dcr as you would normally use 'dcr' my $something = iwpt_dcr_value('current_dcr.blah') }}
Okay - so you don't have a clue as to what you're doing - right?You're mixing perl code and XML code as if it were completely interchangeable.You don't know about dcr being a reserved word as a reference to the DCR passed in on the command line.And you may or may not have sufficient syntax for getting the list of DCRs because you haven't shown the format of the DCR that's being passed in on the command line, but you seem to be assuming that at its root level is a replicant list of other DCRs to load (perhaps there is, but it seems unlikely to me).I suggest you take some training and/or hire someone to assist you.
* recovering from dizziness after reading john742's most recent post *If I understand correctly -- and I have no confidence that I do -- your presentation template is basically gathering DCR's depending on their date and then you would like it to iterate on those?If so, you could get away with something so crude as:@dcr_list = `/bin/ls -1 $year-$mon-$day.*`;...<iw_iterate var='dcr_element' list='dcr_list'>...</iw_iterate>For instance. I would recommend the above since it's not that well written but it would seem to approximate what you're trying to do. In this case, "dcr_element" is the variable you would use to reference each DCR.
you said iwpt_compile allows allows for NO dcr's to be passed to it? What syntax is used for this? Thanks guys I really appriciate the help. This has been an isue for some time. Thanks again
Firstly you must be mistaken on the code syntax. Within a CDATA tag this is completely acceptable. Are you having a bad day or what?
I think you may want to look back at the manuals again yourself. Also I did believe 'dcr' to be a reference, but can you show me in the manuals where it tells you that it is a reference value?
Note: Since 'dcr' is reserved for the global DCR list, it is a incorrect to name the root node of your parse tree '$dcr'. For example: # Bad ! Now is ambiguous! # | Don't do it! # V my $dcr = iwpt_load_dcr('c/d.xml','dcrlocal');
Finally I have an array of the loaded dcr's but that is not the same as what is in 'dcr'
calling the PT:$clt_home/iwpt_compile.ipl -pt $main_page_presentation_template -ofile $main_html_file_location$main_html_file -iw_pt-arg path=$posting `;loading the dcr's:if ($amount_of_postings > $max_posting) { foreach $nonexpired_dcr(@sorted_dcr_files_to_include) { $dcr_creation_date = $nonexpired_dcr; $dcr_creation_date =~ s/.dcr$//; if (convert_time_to_epoch($dcr_creation_date) > $expired_dcr_time) { iwpt_load_dcr("../data/$data_path/$nonexpired_dcr",'ptlocal','t'); } } } else { foreach $nonexpired_dcr(@sorted_dcr_files_to_include) { iwpt_load_dcr("../data/$data_path/$nonexpired_dcr",'ptlocal','t'); } }Iterating thru the loaded dcr's:<br> <br><br> <br> foreach my $index ( iwpt_dcr_list( 'dcr' ) )<br> {<br> <iw_iterate var='index' list='dcr' iteration = "i"><br> <iw_if expr = '($i % 2) eq 0'><br> <iw_then><br> <tr bgcolor="#FFFFFF"><br> </iw_then><br> <iw_else><br> <tr bgcolor="#CCCCCC"><br> </iw_else> <br> </iw_if><br> <TD ALIGN=LEFT VALIGN=CENTER ><iw_value name = 'index.notice_type' /></TD><br> <TD ALIGN=LEFT VALIGN=CENTER ><iw_value name = 'index.posted_date' /> <iw_value name = 'index.posted_time' /></td></TD><br> <iw_if expr = '$four_column eq "true" '><br> <iw_then><br> <TD ALIGN=LEFT VALIGN=CENTER ><iw_value name = 'index.effective_date' /></td></TD><br> </iw_then><br> </iw_if> <br> <TD ALIGN=LEFT VALIGN=CENTER ><A HREF="./document_repository/<iw_value name = 'index.html_name'/>.inc.html"><iw_value name = 'index.subject_title' /></td></TD><br> </iw_iterate><br> }<br><br>
FYI: using ptlocal mode requires you to specific the path to the dcr relative to the presentation temaplte that you call.
<iw_perl>my $html = q{};my $i = 0;my $td_start = qq[<td align="left" valign="center">]; # convenienceforeach my $index (iwpt_dcr_list('dcr')) { $html .= ($i % 2) ? qq[<tr bgcolor="#CCCCCC">\n] : qq[<tr bgcolor="#FFFFFF">\n]; $html .= sprintf("%s%s</td>\n%s%s %s</td>\n" , $td_start , iwpt_dcr_value('index.notice_type') , $td_start , iwpt_dcr_value('index.posted_date') , iwpt_dcr_value('index.posted_time')); if ($four_column eq "true"){ $html .= sprintf("%s%s</td>\n", $td_start, iwpt_dcr_value('index.effective_date')); } $html .= sprintf(qq[%s<a href="./document_repository/%s.inc.html">%s</td>\n] , $td_start , iwpt_dcr_value('index.html_name') , iwpt_dcr_value('index.subject_title')); $i++;}iwpt_output($html);</iw_perl>