Jump to content


[Hack] Add bottom navigation links to MKPortal


  • You cannot reply to this topic
No replies to this topic

#1 visiblesoul

  • Administrators
  • 551 posts
  • Location:Earth
  • Texas

Posted 24 May 2006 - 12:12 PM

Note: This hack adds a query to functions.php. So be aware that there will be one extra query with every page load.

This will put the linkbar directly below the closing tags for the main portal table. This linkbar will be formatted exactly like the top linkbar.

Note that in my first screenshot I have centered the navigation links in style.css like this...


/*=============================
M
K  navstrip styles
P
=============================*/
/* top navstrip */
.navigatore {	
	vertical-align: bottom;
	text-align: center;
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-weight: 300;
	font-size: 9px;
}
Screenshot:
Posted Image

FIND in /mkportal/templates/default/tpl_main.php
function view_footer($block) {
ADD ABOVE:
// Bottom linkbar
function view_linkbar2($row_link) {
global $mklib, $mkportals;
return <<<EOF

<!-- begin linkbar -->
<table width="100%" cellpadding="0" cellspacing="0" border="0">
	<tr>
	  <td>
		<table width="100%" align="center" cellspacing="0" cellpadding="2" border="0">
		  <tr>
		<td class="navigatore" style="padding: 4px;">		  
		  $row_link		   
		</td>
		  </tr>
		</table>
	  </td>
	</tr>
</table>
<!-- end linkbar -->

EOF;
}
// end Bottom linkbar
FIND in /mkportal/include/functions.php
$output .= $Skin->close_main();
ADD BELOW:
		// Bottom linkbar
		$row_link = "";
		$query = $DB->query( "SELECT icon, title, url, position, target FROM mkp_mainlinks WHERE type = '1' ORDER BY `position`");
		while( $row = $DB->fetch_row($query) ) {
			$showlink = $this->checklinkperm($row['url']);
			if($showlink) {continue;}
			$target = "";
			$row['icon'] = str_replace("<IMG>","$this->images", $row['icon']);
			$row['url'] = str_replace("<MKURL>","$this->siteurl", $row['url']);
			$row['url'] = str_replace("<MKFURL>","$mkportals->base_url", $row['url']);
			if (stristr($row['title'], '<LNG>')) {
				$titlel = str_replace("<LNG>","", $row['title']); 
				$row['title'] = $this->lang[$titlel];
			}
			if ($row['target'] == 1) {
				$target = "target="_blank"";
			}
			$row_link .= $Skin->row_link("{$row['icon']}", "href='{$row['url']}' $target", $row['title']);
		}
		if ($this->disablenav != 1) {
			$output .= $Skin->view_linkbar2($row_link);
		}
		// end Bottom linkbar
-----------------------
Here is a modified versions the tpl_main edit. The formatting is just a little different. It doesn't use the "navigatore" bar style and it centers the links. The functions.php edit would be the same as above.

Screenshot:
Posted Image

// Bottom linkbar centered with icons
function view_linkbar2($row_link) {
global $mklib, $mkportals;
return <<<EOF

<!-- begin linkbar -->
<table width="100%" cellpadding="0" cellspacing="0" border="0">
	<tr>
	  <td>
		<table width="100%" align="center" cellspacing="0" cellpadding="2" border="0">
		  <tr>
		<td style="text-align: center; padding: 4px;">		  
		  $row_link		   
		</td>
		  </tr>
		</table>
	  </td>
	</tr>
</table>
<!-- end linkbar -->

EOF;
}
// end Bottom linkbar
-----------------------
Here is yet another version of the bottom linkbar. It does not use the icons, it centers the links, and it follows the WAI convention of putting a html character between links.

The edits are different for tpl_main.php and functions.php in this version...

Screenshot:
Posted Image

FIND in /mkportal/templates/default/tpl_main.php
function view_footer($block) {
ADD ABOVE:
// Bottom linkbar centered without icons
function view_linkbar2($row_link) {
global $mklib, $mkportals;
return <<<EOF

<!-- begin linkbar -->

<div style="text-align: center; padding: 4px;">$row_link|</div>

<!-- end linkbar -->

EOF;
}
FIND in /mkportal/templates/default/tpl_main.php
function view_quote($content, $author) {
ADD ABOVE:
function row_link2($url, $text) {
global $mklib;
return <<<EOF

<!-- begin link template -->

		| <a class="uno" $url>$text</a>

<!-- end link template -->

EOF;
}
FIND in /mkportal/include/functions.php
$output .= $Skin->close_main();
ADD BELOW:
		// Bottom linkbar centered with no icons
		$row_link = "";
		$query = $DB->query( "SELECT title, url, position, target FROM mkp_mainlinks WHERE type = '1' ORDER BY `position`");
		while( $row = $DB->fetch_row($query) ) {
			$showlink = $this->checklinkperm($row['url']);
			if($showlink) {continue;}
			$target = "";
			$row['url'] = str_replace("<MKURL>","$this->siteurl", $row['url']);
			$row['url'] = str_replace("<MKFURL>","$mkportals->base_url", $row['url']);
			if (stristr($row['title'], '<LNG>')) {
				$titlel = str_replace("<LNG>","", $row['title']); 
				$row['title'] = $this->lang[$titlel];
			}
			if ($row['target'] == 1) {
				$target = "target="_blank"";
			}
			$row_link .= $Skin->row_link2("href='{$row['url']}' $target", $row['title']);
		}
		if ($this->disablenav != 1) {
			$output .= $Skin->view_linkbar2($row_link);
		}
		// end Bottom linkbar



Please note that I offer free support on this forum in my free time. Depending on how much work I have backlogged it may take me a week or more to answer questions. I am not ignoring you. I answer everyone but please be patient. Thanks.

Disclaimer: All forum posts, including code examples, on this forum are offered for free in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Use code examples at your own risk.

"If at first you don't succeed, keep on suckin' til you do succeed." -Curly Howard





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users