Gidday all,
Im having trouble with variable scope her I think.
In the code below I can't test $subCategory when I move it inside the if statement.
What Im trying to do is only add the value of $subCategory to the output if there are links associated with it. ie anchortext has a value.
Any help appreciated.
Thank You
Colin
foreach my $iteration1 (iwpt_dcr_list('dcr.Content Layout.Column 1.DCR to Load')){
my $Heading = iwpt_dcr_value('$iteration1.Heading');
$column1output .= $Heading."<br />";
my $nextDCR = iwpt_load_dcr( iwpt_dcr_value('$iteration1.DCR NAME'), 'cwd', 't' );
foreach my $iteration2 (iwpt_dcr_list('$nextDCR.Topic List by Category.Entry')){
my $subCategory = iwpt_dcr_value('$iteration2.Sub Category');
my $anchorText = iwpt_dcr_value('$iteration2.Link Details.Anchor Text');
if($anchorText ne ""){
$column1output .= (($subCategory ne "") ? qq[<br />$subCategory<br />] : "" );
my $linkTag = qq[<a href="#">$anchorText</a>];
$column1output .= qq[$linkTag<br />];
my $first_char;
$first_char = substr( lcfirst( $anchorText ) ,0 ,1 );
if( ! exists( $hashAlphabet{ $first_char } ) ){
$hashAlphabet{ $first_char } = 1;
}
push(
@arrayItemsToSort, $anchorText );
$hashItemsMaster{ $anchorText } = $linkTag;
}
}
}