Moving Knowledgebase cats to index page

Everything related to Hesk - helpdesk software

Moderator: mkoch227

Post Reply
garymchu
Posts: 1
Joined: Sat Jun 06, 2009 11:49 pm

Moving Knowledgebase cats to index page

Post by garymchu »

/*************************************
Title: Helpdesk
Version: latest
Author:
Demo:
Download:
Website:

Short description: Moving Knowledgebase cats to index page


*************************************/

I am interested in moving knowledgebase cats to the index page where you currently see the red text

http://www.talentedacts.com/help/

Anyone managed to do this that could post a little how to????

Thanks

gary
Gary D Mchugh
Klemen
Site Admin
Posts: 10136
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

You can copy and use the code from knowledgebase.php. For example in the index.php file just below

Code: Select all

<p><span class="homepageh3"><?php echo $hesklang['kb_text']; ?></span></p>
paste something like

Code: Select all

    <?php
    $catid = 1;
	$sql = 'SELECT * FROM `'.$hesk_settings['db_pfix'].'kb_categories` WHERE `parent`=\''.$catid.'\' AND `type`=\'0\' ORDER BY `parent` ASC, `cat_order` ASC';
	$result = hesk_dbQuery($sql);
	if (hesk_dbNumRows($result) > 0)
	{
        ?>

		<p>&raquo; <b><?php echo $hesklang['kb_cat_sub']; ?>:</b></p>

		<table border="0" cellspacing="1" cellpadding="3" width="100%">

		<?php
		$per_col = $hesk_settings['kb_cols'];
		$i = 1;

		while ($cat = hesk_dbFetchAssoc($result))
		{

			if ($i == 1)
		    {
				echo '<tr>';
		    }

			echo '
		    <td width="50%" valign="top">
			<table border="0">
			<tr><td><img src="img/folder.gif" width="20" height="20" alt="" style="vertical-align:middle" /><a href="knowledgebase.php?category='.$cat['id'].'">'.$cat['name'].'</a></td></tr>
			';

			/* Print two most popular articles */
			if ($hesk_settings['kb_numshow'] && $cat['articles'])
		    {
		    	$sql = 'SELECT `id`,`subject` FROM `'.$hesk_settings['db_pfix'].'kb_articles` WHERE `catid`=\''.$cat['id'].'\' AND `type`=\'0\' ORDER BY `views` DESC, `art_order` ASC LIMIT '.($hesk_settings['kb_numshow']+1);
		        $res = hesk_dbQuery($sql);
		        $num = 1;
				while ($art = hesk_dbFetchAssoc($res))
				{
					echo '
		            <tr>
		            <td><img src="img/article_text.png" width="16" height="16" border="0" alt="" style="vertical-align:middle" />
		            <a href="knowledgebase.php?article='.$art['id'].'" class="article">'.$art['subject'].'</a></td>
		            </tr>';

		            if ($num == $hesk_settings['kb_numshow'])
		            {
		            	break;
		            }
		            else
		            {
		            	$num++;
		            }
				}
		        if (hesk_dbNumRows($res) > $hesk_settings['kb_numshow'])
		        {
		        	echo '<tr><td>&raquo; <a href="knowledgebase.php?category='.$cat['id'].'"><i>'.$hesklang['m'].'</i></a></td></tr>';
		        }
		    }

			echo '
			</table>
		    </td>
			';

			if ($i == $per_col)
		    {
				echo '</tr>';
		        $i = 0;
		    }
			$i++;
		}
		/* Finish the table if needed */
		if ($i != 1)
		{
			for ($j=1;$j<=$per_col;$j++)
		    {
				echo '<td width="50%">&nbsp;</td>';
				if ($i == $per_col)
			    {
					echo '</tr>';
			        break;
			    }
		        $i++;
		    }
		}

		?>
		</table>

	<?php
	} // END if NumRows > 0
	?>
This should get you started.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Post Reply