Can we use something like this???[html] if(condition) { $var="page"."$a";} ]]>[/html]I am getting erroriw_ostream 'buffer' attribute must start with a letter, or underscore, and be followed by any number of letters, digits, or underscores.I have checked the values being assigned to buffer, they look right!!!
Still it is not working?????[html]$va=$z%9; if($va==0 && $z!=0) {$a=$z/9; $vl="page"."$a";} ]]>[/html]
sorry, i did not note, what are you trying to do? By the way, what do you think the buffer attribute does?
<iw_iterate var='x' list='dcr.rt.container' iteration='z'> <iw_perl> my $vl = "page" . ($z < 9) ? "" : int($z / 9); </iw_perl> <iw_ostream buffer='vl'> <!-- I assume there is stuff here that was not posted --> </iw_ostream></iw_iterate>
I believe there is an error in the logic you are trying to use within the iteration, and I believe the value for buffer should not have a '$' on it - try this and see if it works any better:<iw_iterate var='x' list='dcr.rt.container' iteration='z'> <iw_perl> my $vl = "page" . ($z < 9) ? "" : int($z / 9); </iw_perl> <iw_ostream buffer='vl'> <!-- I assume there is stuff here that was not posted --> </iw_ostream></iw_iterate>This is assuming that the 'main' buffer should just be called "page" and that the next one would be "page1", then "page2", etc.
I dont think logic is the problem ... becuase i was able to verify the logic by printing the values
Hmm - yeah, I guess I can see how it works now, I was assuming better scoped variables - my code is simpler, but yours works because you only increment $a (which is globally scoped) whenever $z % 9 is 0 (an $z isn't 0 - to skip the first time)However, I don't see an initialization of $vl, which I guess you're assuming is initialized to the empty string and that using the buffer attribute with the empty string is the same thing as not specifying the buffer attribute. This may be true, but it's a risky and questionable coding practice making such assumptions.Are you sure the problem is in this part of your code and not in the part where you actually try to output the contents of the different buffers? (you haven't shown us that code) - and of course, adding debugging here would help to verify that you are getting what you think you are - but perhaps you've already done that - we cannot tell.
Hi Ghoti,I have attached my full tpl for you review the problems i am having area) If i have global variables, as iw_ostream is outside of the if loop it is taking blank values, hence it is complaining about giving blank values to buffer attribute, can i use iw_ostream within iw_perl or how can i avoid it getting null valuesb)and i am not able to find out how to use the buffer attribute without $ or with $ or using iw_value[html]oror[/html]neither of them is successful
Though double quotes should not matter but Try using double quotes and use the $ sign for your variable.. That should work for sure.. I have something similar running at my end..If it still does not work, log a case with IWOV support and do your work in perl without the iw_iterate tag..
even that doesnt work can you please send me what you have at your end may be will help me find out what i am doing wrong
buffer - Optional attribute.
If a 'buffer' is specified, but a 'file' or 'file_val'
is not, then all output generated within the
tag is simply stored in a temporary buffer, and is not
written to a file when closes. If the same
buffer name is used by multiple tags, the output
generated by the later tag(s) is appended to that buffer.
If a 'buffer' is specified along with a 'file' or 'file_val'
attribute, then the contents of the 'buffer' are written
to the appropriate file, and the buffer's value is reset
to the empty string ("") after the tag closes.
If no 'file', 'file_val', or 'buffer' attribute is specified,
the default buffer (named "default") is used. This is
convenient when the tag is being used to filter
content in the primary generated page (see 'filter' below).
The 'buffer' attribute allows template authors to write to
multiple output streams in any order, and flush the contents
of these buffers to disk all at once.
There is no problem with your syntax I believe. I think, your usage is not correct. Even if you have specified a different buffer, you do not seem to be providing a page name? Have a look at this and please read the manuals .buffer - Optional attribute. If a 'buffer' is specified, but a 'file' or 'file_val'is not, then all output generated within the tag is simply stored in a temporary buffer, and is notwritten to a file when closes. If the samebuffer name is used by multiple tags, the outputgenerated by the later tag(s) is appended to that buffer.If a 'buffer' is specified along with a 'file' or 'file_val'attribute, then the contents of the 'buffer' are writtento the appropriate file, and the buffer's value is resetto the empty string ("") after the tag closes.If no 'file', 'file_val', or 'buffer' attribute is specified,the default buffer (named "default") is used. This isconvenient when the tag is being used to filtercontent in the primary generated page (see 'filter' below).The 'buffer' attribute allows template authors to write tomultiple output streams in any order, and flush the contentsof these buffers to disk all at once.
There is no problem with your syntax I believe. I think, your usage is not correct. Even if you have specified a different buffer, you do not seem to be providing a page name? Have a look at this and please read the manuals .buffer - Optional attribute. If a 'buffer' is specified, but a 'file' or 'file_val' is not, then all output generated within the tag is simply stored in a temporary buffer, and is not written to a file when closes. If the same buffer name is used by multiple tags, the output generated by the later tag(s) is appended to that buffer. If a 'buffer' is specified along with a 'file' or 'file_val' attribute, then the contents of the 'buffer' are written to the appropriate file, and the buffer's value is reset to the empty string ("") after the tag closes. If no 'file', 'file_val', or 'buffer' attribute is specified, the default buffer (named "default") is used. This is convenient when the tag is being used to filter content in the primary generated page (see 'filter' below). The 'buffer' attribute allows template authors to write to multiple output streams in any order, and flush the contents of these buffers to disk all at once.
I had started implementing only after reading this. Can you please suggest, which manual probably has information about this??? . what i said was if i assign a constant value to buffer attribute it is working and if i try to assign variable values to it by using the iw_iterate it is not working. I am sorry if my statements were ambigous
You are still aiming the wrong direction. You also need to specify a value for the file or file_val attribute... The tags are probably not covered in the manual but lie on your server... The same has been explained in the manual
can you please see the code i attached to post no 10
however, 'file' takes a string, instead of a variable name.
when the name of the file must be generated on
the fly in a loop (eg: a_0.html, a_1.html, ...).
Also you need to use
iw_ostream buffer="$vl" file_val="$filename" or
iw_ostream buffer="$vl" file="{iw_vale name='$filename'/}"
Please note you need to specify the file or file_val
attribute the first time you use iw_ostream for the buffer
Here is what I see at my end - Your first iw_ostream tag does not have the attribute file or file_val[HTML] <br> <br> $va=$z%9; <br> <br> if($va==0 && $z!=0)<br> {<br> $a=$z/9;<br> $vl="page"."$a";<br> <br> <br> } <br> <br> <br> try <br> my @y = iwpt_dcr_list('dcr.rt.construction');<br> $a= @y;<br> <br> <br> <br> $va=$z/9;<br> $vx=$z%9;<br> $c=$z%3;<br> <br> <br> $va=$z%9;<br> <br> if($va==0 && $z!=0)<br> {<br> $a=$z/9;<br> $vl="page"."$a";<br> <br> $filename="templatedata/parkContent/constructionPage/data/".$vl.".html";<br> <br> <br> } <br> <br> [/HTML]
if you scroll down you will find at the bottom, question to evryone: sholud we use file attribute the first time you are using iw_ostream
I have it working when I use it the first time