S2 Cookbook: Modules
From Dreamwidth Notes
Revision as of 23:51, 7 November 2010 by Foxfirefey (Talk | contribs)
function print_module_navlinks() { var Page p = get_page(); var string[] navlinks_order = []; var string{} navlinks_urls = {}; var string{} navlinks_text = {}; $navlinks_order = [ "recent", "archive", "read", # remove this for unpaid journals "network", "tags", "memories", "custom1", "custom2", "userinfo", ]; $navlinks_urls = { "recent" => "$p.base_url/", "archive" => "$p.base_url/calendar", "read" => "$p.base_url/read", "network" => "$p.base_url/network", "tags" => "$p.base_url/tag", "memories" => "$*SITEROOT/tools/memories?user=$p.journal.username", "custom1" => "http://URL", "custom2" => "http://URL", "userinfo" => "$p.base_url/profile", }; $navlinks_text = { "recent" => "$*text_view_recent", "archive" => "$*text_view_archive", # use $*text_view_friends_comm for communities "read" => "$*text_view_friends", "network" => "$*text_view_network", "tags" => "$*text_view_tags", "archive" => "$*text_view_memories", "custom1" => "Custom Text", "custom2" => "Custom Text", "userinfo" => "$*text_view_userinfo", }; open_module("navlinks", "", ""); var string[] links = []; 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>"""; } } print_module_list($links); close_module(); }