in reply to Re: Excluding pages from the navigation
in thread Excluding pages from the navigation

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>

Replies are listed 'Best First'.
Re^3: Excluding pages from the navigation
by marto (Cardinal) on Oct 29, 2009 at 15:08 UTC

    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?
        I don't know MediaSurface (and couldn't find much in Google), but the whole point of a CMS is that changes like 'remove one item from the navigation list' are done via a user-friendly tool and saved in a database, not done in code.

        If you've already considered this, then you probably need to look at this code:
        my $linkslist = str_links($parentlink, '$path,$name,$itemid:', 1, 'order', 'sortnumeric');
        where the links are defined. Find the source code for str_links and look at that.

        If you're still stuck and aren't prepared to try anything else yourself, get in touch with the people who sold you MediaSurface (they will probably tell you to upgrade). That would be better than continuing to ask questions here without supplying details.



        - Boldra