[personal profile] ex_awakened208 posting in [community profile] style_system
Would it be possible to merge the "previous" and "next" links with the main navigation that has the "recent entries"/"read page"/"tags", etc links in it?

The end result I am looking for is a header navigation that goes in this order:

previous | recent entries | archive | read | tags | info | next

I would prefer if the previous/next links only show up if there are actually entries before/afterward.

I hope that was clear enough! Thanks in advance.

Date: 2012-12-20 11:54 pm (UTC)
marahmarie: (M In M Forever) (Default)
From: [personal profile] marahmarie
Is it because I already have custom navlink code in my theme layer that putting the prev/next in the navlinks is not working? My code is here:
http://www.dreamwidth.org/customize/advanced/layersource?id=116552&fmt=html

Date: 2012-12-21 12:15 am (UTC)
foxfirefey: A guy looking ridiculous by doing a fashionable posing with a mouse, slinging the cord over his shoulders. (geek)
From: [personal profile] foxfirefey
Yes, the function can only be used once. Replace both of them with this:

# code by ninetydegrees/foxfirefey
function print_module_navlinks() {
 
  var Page p = get_page();
  var string prev_link;
  var string next_link;
  
  if ( $p isa EntryPage ) {
      var EntryPage ep = get_page() as EntryPage;
      var Entry e = $ep.entry;
      var Link prev = $e->get_link("nav_prev");
      $prev_link = """<a href="$prev.url">$prev.caption</a>""";
      var Link next = $e->get_link("nav_next");
      $next_link = """<a href="$next.url">$next.caption</a>""";
  } elseif ( $p isa DayPage ) {
      var DayPage dp = get_page() as DayPage;
      $prev_link = """<a href="$dp.prev_url">$*text_day_prev</a>""";
      $next_link = """<a href="$dp.next_url">$*text_day_next</a>""";
  } elseif ( $p isa RecentPage ) {
      var RecentPage rp = get_page() as RecentPage;
      if ( $rp.nav.backward_count > 0 ) { 
          $prev_link = """<a href="$rp.nav.backward_url">""" + get_plural_phrase( $rp.nav.backward_count, "text_skiplinks_back" ) + "</a>"; 
      }
      if ( $rp.nav.forward_count > 0 ) { 
          $next_link = """<a href="$rp.nav.forward_url">""" + get_plural_phrase( $rp.nav.forward_count, "text_skiplinks_forward" ) + "</a>"; 
      }
  } elseif ( $p isa MonthPage ) {
      var MonthPage mp = get_page() as MonthPage;
  	if ($mp.prev_url != "") { $prev_link = "<a href='$mp.prev_url'>Previous</a>"; }
  	if ($mp.next_url != "") { $next_link = "<a href='$mp.next_url'>Next</a>"; }
  }

  var string[] navlinks_order = [];
  var string{} navlinks_urls = {};
  var string{} navlinks_text = {};
 
  $navlinks_order =
    [
        "userinfo",
        "tags",
        "archive",       
        "journals",
        "communities",
        "networkpc", 
    ];
 
 $navlinks_urls =
    {   "userinfo" => "$p.base_url/profile",
        "tags" => "$p.base_url/tag",  
        "archive" => "$p.base_url/calendar",        
        "journals" => "$p.base_url/read?show=P",
        "communities" => "$p.base_url/read?show=C",
        "networkpc" => "$p.base_url/network?show=PC",       
        
    };
 
 $navlinks_text =
    {   "userinfo" => "About",
        "tags" => "All Tags",
        "archive" => "Archives",        
        "journals" => "DW People",        
        "communities" => "DW Places",
        "networkpc" => "DW Plains",        
        
    };

 
    open_module("navlinks", "", "");
    var string[] links = [];
    
    if ( $prev_link ) {
        $links[size $links] = $prev_link;
    }    
    
    foreach var string k ($navlinks_order) {
        if ($navlinks_urls{$k} != "") {
            var string css = """ class="$k" """;
            if ($p.view == $k) { $css = """ class="current $k" """; }
            $links[size $links] = """<a href="$navlinks_urls{$k}"$css>$navlinks_text{$k}</a>""";
        }
    }
    
    if ( $next_link ) {
        $links[size $links] = $next_link;
    }
     
    
    print_module_list($links);
    close_module();
}
Edited Date: 2012-12-21 12:16 am (UTC)

Date: 2012-12-21 01:29 am (UTC)
marahmarie: (M In M Forever) (Default)
From: [personal profile] marahmarie
♥ I'm in the middle of changing [community profile] css_code's CSS around but will hop back to my DW shortly to try this out - thanks!

(And yeah, so my hunch was right - couldn't imagine what else it was.)

ETA: worked like a charm - and you wrote that up really quick.
Edited Date: 2012-12-21 01:57 am (UTC)

Profile

Dreamwidth style system discussion

October 2025

S M T W T F S
   1 234
567891011
12131415161718
19202122232425
262728293031 

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Jan. 4th, 2026 04:20 pm
Powered by Dreamwidth Studios