http://www.perlmonks.org?node_id=803946


in reply to Excluding pages from the navigation

It would very much help if you'd wrap your code in <code> tags:

<code>
# Code goes here
</code>
  • Comment on Re: Excluding pages from the navigation

Replies are listed 'Best First'.
Re^2: Excluding pages from the navigation
by webteam (Initiate) on Oct 29, 2009 at 14:47 UTC
    Thank you so much, I have placed a <code> tag in there. Basically the script below is used in MediaSurface content management system.
    <server language="perl"> print "<div id=\"maincontent\">"; #<!-- LEFT --> print"<div id=\"left\">"; <code> if ($item{itemtypeid} =~ '2572100') { print qq(<span class="sectionBack">&#60; <a href="/">Home</a></span>); print "<ul class=\"sectionNav\">\n"; print str_links(undef, '<li><a href=$url>$name</a></li>\n', 1, 'order' +, 'sortnumeric'); print "</ul>\n"; } else { my $sectionurl = "/" . substr(str_primaryattachpoint(), 1, index(str_p +rimaryattachpoint(), '/', 1)); my $sectionurl2 = str_primaryattachpoint(); my $sectionurl3 = str_primaryattachpoint($sectionurl2); my %section = getitem($sectionurl3, 0); print "<div id=\"leftnav\">"; my $parentlink = str_primaryattachpoint(); my $linkslist = str_links($parentlink, '$path,$name,$itemid:', 1, 'ord +er', 'sortnumeric'); my @topvariables = split(/:/, $linkslist); my $count = @topvariables; my $int = '0'; while ($int < $count) { foreach my $topvariables (@topvariables) { (my $link, my $title, my $id) = split(/,/, $topvariables); $topvariables[$int] = ([$link, $title, $id]); $int++; } } my $parentslink = str_previousbranch(); my $int2 = '0'; print "<ul class=\"sectionNav\">\n"; foreach (@topvariables) { #print $topvariables[$int2][2]. "<br>"; #print $item{itemid} . "<br>"; if ($topvariables[$int2][2]=~$item{itemid}) { print "<li><a class=\"currentpage\" href=\"$topvariables[$int2][0]\">$ +topvariables[$int2][1]</a>\n"; print "<ul class=\"submenu\">\n"; print str_links($topvariables[$int2][0], '<li class=\"nav2\"><a href=\ +"$path\" class=\"submenu\">$name</a></li>\n', 1, 'order', 'sortnumeri +c'); print "</ul></li>\n"; } else { print "<li><a href=$topvariables[$int2][0]>$topvariables[$int2][1]</a> +</li>\n"; print "<ul style='display:none;'>\n"; print str_links($topvariables[$int2][0], '<li class=\"nav2\"><a href=$ +url>$name</a></li>\n', 1, 'order', 'sortnumeric'); print "</ul></li>\n"; } $int2++; } <code> print "</ul>\n"; } </server>

      Unforgiven told you how to use code tags, your closing code tag should be </code> and not <code>, for some reason you aren't placing these tags prior to the start of the code, and after the end.

      The reason for previewing before posting is to check your post format and content. Also there are links provided to How do I post a question effectively? and Writeup Formatting Tips, it would be wise to read these. Finally you could have simply edited your first post, adding code tags, rather than posting it all again.

        I am really sorry to cause all these problems. I have now added the opening and closing <code> tags in my original post. The code is a navigation system which is mixed up with html code so it displays correctly. I am new to Perl, so any help would be appreciated. Could I upload screenshots to this post to be able to explain the issue I am having more clearly?