Jump to content
Sign in to follow this  
VJ

[Contribution] Links Manager for osC v1.00

Recommended Posts

Hopefully this will be a quick fix. I have run out of ideas. Yesterday I installed Ultimate SEO URLs & have it disabled because with it on, when you click on one of the cateogries you get sent to a non-displayable page.

 

Today, I installed Links Manager for OSC & all the link sections in the admin page show up, you can add links, etc. however, there are no links displayed on the website. I cannot figure out what I have done/not done to get the links to show up on the homepage. I had the Fixed Width With CSS2 contrib installed & have even taken that off to see if by limiting the page width I was keeping the links from showing up. Even without the fixed page width the links still don't show up. I have put the fixed page width back on.

 

Has anyone else had this same problem? Does anyone know how to fix it? The website is http://www.custom-farmnet.com

 

Any help would be most gratefully appreciated!

The links seem to be working fine:

http://custom-farmnet.com/oscommerce/links.phpI think you just forgot to add the code to the information box, or anywhere on the page, that lets you link to the links page.

 

Jack

Share this post


Link to post
Share on other sites

Hi All,

 

I just installed this contribution, and wanted to modify the links.php by adding some custom text, similar to the way it is added in index.php, although when i add the:

 

define('TEXT_MAIN', ' ');

 

Nothing happens, i'm not a coder personally, so i dont really know how to do things, just pick up snippets of information and try and use them elsewhere, so any help would be great. The links.php im editing is the one in catalog/includes/languages/english/links.php

 

Is this the right one?

 

Best Regards

 

Donna

Share this post


Link to post
Share on other sites

The code to display that definition isn't in the links.php file. You will need to add it there. Just add this code somewhere after the HEADING_TITLE section:

		  <tr>
		<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
	  </tr>
	  <tr>
		<td class="main"><?php echo TEXT_MAIN; ?></td>
	  </tr>

 

Jack

Share this post


Link to post
Share on other sites
The code to display that definition isn't in the links.php file. You will need to add it there. Just add this code somewhere after the HEADING_TITLE section:
		  <tr>
		<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
	  </tr>
	  <tr>
		<td class="main"><?php echo TEXT_MAIN; ?></td>
	  </tr>

 

Jack

 

Thanks Jack, im getting there slowly. I added the code into the catalog/links.php file. Then added the code of the text into the catalog/included/languages/english/links.php file and i get 'TEXT_MAIN' rather than the test i have added. I think this is to do with it not being defined or somethign, but thisvariable was used in index.php so i assumed everythign should work...have i missed somethign completely (well of course i have...)

 

Best Regards

 

Donna

Share this post


Link to post
Share on other sites

It matters where you add it in the engllish/links.php file since there is conditioanl code there. If you are noit in a hurry, I have already added this to the next version, which I expect to release within the month.

 

Jack

Share this post


Link to post
Share on other sites
It matters where you add it in the engllish/links.php file since there is conditioanl code there. If you are noit in a hurry, I have already added this to the next version, which I expect to release within the month.

 

Jack

Thanks jack, I'll have another look and if im still struggling i'll hang on for the next release. Any hints as to whats changed in the new version?

 

Best Regards

 

Donna

Share this post


Link to post
Share on other sites

Here's the changes already implemented. I was trying to ad the features others have mentioned. If anyone sees anything I've missed, or just has another suggestion, please mention it.

 

- Added option to make reciprical links an option

- Changed code for email sent when a link is submitted to provide more details.

- Changed default status of notify customer to on in link edit window

- Added options link edit for disabled links. The customer will be notified if the link was denied due to a bad link or bad content, depending on the setting.

- Added the code to display text for the various links pages, under the title. The text for the Links Submit page needs to be edited to fit your site.

- Fixed bug in All Links check code. The last link was not being checked.

- Added option to check for duplicate links when a new link is submitted on the links submit page.

- Added a Suggest A Category option on the Link Submit page.

- Added default icon image code back in. Many people don't use these but some do and it is standard practice to include the code.

- Added option to switch the display from standard to vertical in admin->configuration->Links.

 

Jack

Share this post


Link to post
Share on other sites

Hi Jack,

 

I've managed to add some text into links.php so i can chat a little about the page, but i have a couple of questions.

 

Where the search box is at the bottom, teh button next to it says submit link, and when clicked takes you to the submit link page? Is this something i have possible messed with, or is this how the contribution is spose to look, as its quite misleading?

 

Also, at the top of the page when i click featured link it takes me to my homepage - how can i get this to be a featured page? Is this related to the 'rating' on the admin side? How does this rating work?

 

I put a sites rating as 5 but it doesnt seem to change anything or its position when in the dorectory?

 

I do go on don't i...

 

Just some further thoughts...is there any plan to incorporate a proper featured links section - whereby the possibility of placing a sites banner and some text for say a 30 period could be incorporated from the admin side? And also any thoughts on have a paid inclusion, for example a top 5 listing in the directory...

 

Just some thoughts, i;m looking forward to the next release as you mentioned above. I guess the possibililty is endless...

 

Regards

 

Donna

Share this post


Link to post
Share on other sites

hi, jack

 

is there a way i can also have images with my links

 

ie. upload via admin

 

and if customers send the link they can also upload and send the image.

Share this post


Link to post
Share on other sites

Yes, enable that option in admin->configuraton->links and add the image when you add/edit the link.

 

Jack

Share this post


Link to post
Share on other sites

It is handled in the form of a .php file (links_setup.php). See th instructions as to how to use it.

 

Jack

Share this post


Link to post
Share on other sites

A new version has been uploaded. Here is what was changed:

 

- Added option to make reciprocal links an option.

- Added a link to the page in the message sent when a link exchange is approved. The code adds the link in the Ultimate SEO format. This shouldn't cause a problem for those sites that don't use that contribution but if it does, this part of the code will need to be disabled or changed.

- Added options link edit for disabled links. The customer will be notified if the link was denied due to a bad link or bad content, depending on the setting.

- Added the code to display text for the various links pages, under the title. The text for the Links Submit page needs to be edited to fit your site.

- Added option to check for duplicate links when a new link is submitted on the links submit page.

- Added a Suggest A Category option on the Link Submit page.

- Added code on Link Submit page to automatically verify the submitted link.

- Added default icon image code back in. Many people don't use these but some do and it is standard practice to include the code.

- Added option to switch the display from standard to vertical in admin->configuration->Links.

- Added code to allow links of any language to be displayed no matter what language is selected (only works for English, German, Spanish and French and only if the default order is in place).

- Added option to check the reciprocal link when the Edit is clicked in admin. This will slow down the loading of the edit page a little so disable this option if that is a problem.

- Added Visit Reciprocal Link link to the links edit page in admin to allow for a quick check of the site.

- Added a last checked status page so the status of the links can be seen at a glance. The table is updated any time a link is checked.

- Added a script that can be ran as a cron job to check the scripts automatically. The last checked status will be adjusted accordingly.

- Added error checking/display code in admin/links.php for when a new link is created.

- Changed code for email sent when a link is submitted to provide more details.

- Changed default status of notify customer to on in link edit window.

- Changed the check phase to allow for more than one phase to be used.

- Changed Featured Links code to allow for more featured links and allow them to be shown for a certain length of time.

- Fixed bug in All Links check code. The last link was not being checked.

- Fixed the Maximum description size code. It wasn't working as it should.

- Rearranged configuration settings and added color to sections to make the options easier to find. This will only apply to new installs.

 

Obviously, this is a major change. I expect the most difficulty will come with updating the database. Please be sure to make backups before making these changes. Instructions are included and this has all been tested, but sometimes errors still creep in.

 

Jack

Share this post


Link to post
Share on other sites
A new version has been uploaded. Here is what was changed:

 

- Added option to make reciprocal links an option.

- Added a link to the page in the message sent when a link exchange is approved. The code adds the link in the Ultimate SEO format. This shouldn't cause a problem for those sites that don't use that contribution but if it does, this part of the code will need to be disabled or changed.

- Added options link edit for disabled links. The customer will be notified if the link was denied due to a bad link or bad content, depending on the setting.

- Added the code to display text for the various links pages, under the title. The text for the Links Submit page needs to be edited to fit your site.

- Added option to check for duplicate links when a new link is submitted on the links submit page.

- Added a Suggest A Category option on the Link Submit page.

- Added code on Link Submit page to automatically verify the submitted link.

- Added default icon image code back in. Many people don't use these but some do and it is standard practice to include the code.

- Added option to switch the display from standard to vertical in admin->configuration->Links.

- Added code to allow links of any language to be displayed no matter what language is selected (only works for English, German, Spanish and French and only if the default order is in place).

- Added option to check the reciprocal link when the Edit is clicked in admin. This will slow down the loading of the edit page a little so disable this option if that is a problem.

- Added Visit Reciprocal Link link to the links edit page in admin to allow for a quick check of the site.

- Added a last checked status page so the status of the links can be seen at a glance. The table is updated any time a link is checked.

- Added a script that can be ran as a cron job to check the scripts automatically. The last checked status will be adjusted accordingly.

- Added error checking/display code in admin/links.php for when a new link is created.

- Changed code for email sent when a link is submitted to provide more details.

- Changed default status of notify customer to on in link edit window.

- Changed the check phase to allow for more than one phase to be used.

- Changed Featured Links code to allow for more featured links and allow them to be shown for a certain length of time.

- Fixed bug in All Links check code. The last link was not being checked.

- Fixed the Maximum description size code. It wasn't working as it should.

- Rearranged configuration settings and added color to sections to make the options easier to find. This will only apply to new installs.

 

Obviously, this is a major change. I expect the most difficulty will come with updating the database. Please be sure to make backups before making these changes. Instructions are included and this has all been tested, but sometimes errors still creep in.

 

Jack

 

Hi, Jack!

Thank you for the update! I think it's great! :)

Now, I have some errors:

1. When I tried to set a Featured Link for this month I received this error:

 

1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'ON DUPLICATE KEY UPDATE date_added = now()' at line 1

insert into links_featured (links_id, date_added, expires_date) values ('4', now(), '20060620') ON DUPLICATE KEY UPDATE date_added = now()

 

2. My links don't show up in the store in their categories anymore, in fact, the categories are empty in the store... but they do show up in the admin side. Do I have to put them in again? But they do show up in the admin... :( I guess I have to edit them in the includes/language/ file again...

 

3. I tested the e-mail and it sent out 9 messages. :o

 

Hm, maybe I skipped a file ... I'll go check once again. Here is My Webpage if you want to check it. Any help is very appreciated.

 

I want to thank you, and all those who put a lot of time and patience into this! Thank you!

 

Simone :thumbsup:

Edited by magicsenses

Share this post


Link to post
Share on other sites

1 - What version of mysql are you using. It should be 4.1 or higher. Perhaps I should have used different code for that section?

 

2 - Check the language options in admin->configuration->Links.

 

3 - As opposed to 8 or 10? :)

 

Jack

Share this post


Link to post
Share on other sites
1 - What version of mysql are you using. It should be 4.1 or higher. Perhaps I should have used different code for that section?

 

2 - Check the language options in admin->configuration->Links.

 

3 - As opposed to 8 or 10? :)

 

Jack

 

Hi, Jack! Thank you for the quick reply!

1. The version is 4.0.16. Now what am I gonna do? :(

2. All the languages are "true" but the links still don't show in the catalog... :(

3. ... :D

 

Simone

Edited by magicsenses

Share this post


Link to post
Share on other sites

1 - Replace this line in admin/links_featured.php

			tep_db_query("insert into " . TABLE_LINKS_FEATURED . " (links_id, date_added, expires_date) values ('" . $HTTP_POST_VARS['link_partners'] . "', now(), '" . $expires_date . "') ON DUPLICATE KEY UPDATE date_added = now()");

with this code

			$links_featured_query = tep_db_query("SELECT links_id, date_added, expires_date FROM " .  TABLE_LINKS_FEATURED . " where links_id = " . (int)$HTTP_POST_VARS['link_partners']);
		if (tep_db_num_rows($links_featured_query) > 0)
		  tep_db_query("update " . TABLE_LINKS_FEATURED . " set date_added = now(), expires_date = '" . $expires_date . "' where links_id = '" . (int)$HTTP_POST_VARS['link_partners'] . "'");
		else
		  tep_db_query("insert into " . TABLE_LINKS_FEATURED . " (links_id, date_added, expires_date)	  values ('" . $HTTP_POST_VARS['link_partners'] . "', now(), '" . $expires_date . "')");

 

2 - Click on edit for one of the links and see what the language is set to. Then go to the links setting and disable that language option and then enable it again. Maybe it just needs to be reset. If that fails, try setting the language setting in the edit page to All just to see if that will work.

 

Jack

Share this post


Link to post
Share on other sites
1 - Replace this line in admin/links_featured.php
			tep_db_query("insert into " . TABLE_LINKS_FEATURED . " (links_id, date_added, expires_date) values ('" . $HTTP_POST_VARS['link_partners'] . "', now(), '" . $expires_date . "') ON DUPLICATE KEY UPDATE date_added = now()");

with this code

			$links_featured_query = tep_db_query("SELECT links_id, date_added, expires_date FROM " .  TABLE_LINKS_FEATURED . " where links_id = " . (int)$HTTP_POST_VARS['link_partners']);
		if (tep_db_num_rows($links_featured_query) > 0)
		  tep_db_query("update " . TABLE_LINKS_FEATURED . " set date_added = now(), expires_date = '" . $expires_date . "' where links_id = '" . (int)$HTTP_POST_VARS['link_partners'] . "'");
		else
		  tep_db_query("insert into " . TABLE_LINKS_FEATURED . " (links_id, date_added, expires_date)	  values ('" . $HTTP_POST_VARS['link_partners'] . "', now(), '" . $expires_date . "')");

 

2 - Click on edit for one of the links and see what the language is set to. Then go to the links setting and disable that language option and then enable it again. Maybe it just needs to be reset. If that fails, try setting the language setting in the edit page to All just to see if that will work.

 

Jack

 

Hi, Jack!

 

1. Problem solved! I have a featured link now! :)

2. I reset all the languages, I looked under edit, they were all in English... so, I changed them to ALL just to see if it works, as you said. No, it doesn't. None of my links can be seen in the store. I can see the number next to the categories... but no link. :( I also tried to add a new link. Everything goes well and the link is in the admin panel right now but it doesn't show in the store ... I don't know what prevents them from being published in the catalog :( the only link I have online now is the featured one... and I also set a featured link for one of the categories... and that one shows too... My Webpage

 

Thank you for your support!

Share this post


Link to post
Share on other sites

Did you replace all of your files with the ones from the contribution?

 

Jack

Share this post


Link to post
Share on other sites

Hi Jack I am also having exactly the same problem. I have followed the instructions for the upgrade and everthing on the admin side work perfectly but none of my links are avaikable through the website only the categories.


Scott Lawry

Share this post


Link to post
Share on other sites

Jack I have managed to find the problem which is in the Shop\links.php file. All I have done is replace this file with the previous version and my links have come back. Unfortunately my PHP skills are not good enough to find a fix. Sorry :(


Scott Lawry

Share this post


Link to post
Share on other sites

That should work but you will lose many of the new options. If you want to try, find this code in the links.php file (the new one) at line 389:

		case 'LINK_LIST_COUNT':
	  $listing_sql .= "l.links_clicked " . ($sort_order == 'd' ? 'desc' : '') . ", ld.links_title";
	  break;
  }
}

and add this after it:

echo $listing_sql;

That will display some text on your links page. Copy and paste that here and restore the file to the way you want it.

 

Jack

Share this post


Link to post
Share on other sites

Jack I have managed to get your file to show the links by merging a number of lines from V12. Can you please run your eye over the following code for the Shop\links.php file.

 

<?php

/*

$Id: links.php,v 1.07 2005/5/28 Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

// define our link functions

require(DIR_WS_FUNCTIONS . 'links.php');

 

$linkSearch = '';

$linkFound = false;

$action_search = (isset($_POST['action_search']) ? $_POST['action_search'] : '');

if (tep_not_null($action_search))

{

$linkSearch = $_POST['links_search'];

$link_query = tep_db_query("select l.links_id, l.links_title, lc.links_id, lc.link_categories_id from " . TABLE_LINKS_DESCRIPTION . " l, " . TABLE_LINKS_TO_LINK_CATEGORIES . " lc where l.links_id = lc.links_id AND links_title LIKE '%" . $linkSearch . "%' and language_id = '" . (int)$languages_id . "'");

if (tep_db_num_rows($link_query) > 0)

$linkFound = true;

}

 

// calculate link category path

if (isset($HTTP_GET_VARS['lPath'])) {

$lPath = $HTTP_GET_VARS['lPath'];

$current_category_id = $lPath;

$display_mode = 'links';

} elseif (isset($HTTP_GET_VARS['links_id'])) {

$lPath = tep_get_link_path($HTTP_GET_VARS['links_id']);

} else {

$lPath = '';

$display_mode = 'categories';

}

 

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_LINKS);

 

// links breadcrumb

$link_categories_query = tep_db_query("select link_categories_name from " . TABLE_LINK_CATEGORIES_DESCRIPTION . " where link_categories_id = '" . (int)$lPath . "'");

$link_categories_value = tep_db_fetch_array($link_categories_query);

 

if ($display_mode == 'links') {

$breadcrumb->add(NAVBAR_TITLE, FILENAME_LINKS);

$breadcrumb->add($link_categories_value['link_categories_name'], FILENAME_LINKS . '?lPath=' . $lPath);

} else {

$breadcrumb->add(NAVBAR_TITLE, FILENAME_LINKS);

}

 

/****** DIsplay Feature Links ******/

if (LINKS_FEATURED_LINK == 'True')

{

/****** Find the Featured links for the main links page ******/

$openMode = (LINKS_OPEN_NEW_PAGE == 'True') ? 'blank' : 'self';

$link_featured = '';

$link_featured_query = tep_db_query("select l.links_id, l.links_url, l.links_image_url, ld.links_title, ld.links_description, lf.expires_date from " . TABLE_LINKS . " l, " . TABLE_LINKS_DESCRIPTION . " ld, " . TABLE_LINKS_FEATURED . " lf where l.links_id = ld.links_id AND ld.links_id = lf.links_id AND lf.expires_date >= now() order by RAND()" );

 

if (tep_db_num_rows($link_featured_query) > 0) {

$lf = tep_db_fetch_array($link_featured_query);

 

if (LINKS_TITLES_AS_LINKS == 'True')

$link_featured = $lf['links_title'];

else

$link_featured = '<a href="' . tep_get_links_url($lf['links_id']) . '" target="_' . $openMode . '">' . $lf['links_title'] . '</a>';

 

if (LINK_LIST_IMAGE > 0)

{

if (tep_not_null($lf['links_image_url'])) {

$link_featured .= '<br><a href="' . tep_get_links_url($lf['links_id']) . '" target="_' . $openMode . '">' . tep_links_image($lf['links_image_url'], $lf['links_title'], LINKS_IMAGE_WIDTH, LINKS_IMAGE_HEIGHT) . '</a>';

} else {

$link_featured .= '<br><a href="' . tep_get_links_url($lf['links_id']) . '" target="_' . $openMode . '">' . tep_image(DIR_WS_IMAGES . 'pixel_trans.gif', $lf['links_title'], LINKS_IMAGE_WIDTH, LINKS_IMAGE_HEIGHT, 'style="border: 3px double black"') . '</a>';

}

}

if (LINK_LIST_DESCRIPTION > 0)

$link_featured .= '<br>' . $lf['links_description'];

}

 

/****** Find the Featured Links for the category page ******/

$link_featured_cat = '';

$link_featured_cat_query = tep_db_query("select l.links_id, l.links_url, l.links_image_url, ld.links_title, ld.links_description, lf.expires_date from " . TABLE_LINKS . " l, " . TABLE_LINKS_DESCRIPTION . " ld, " . TABLE_LINKS_FEATURED . " lf, " . TABLE_LINKS_TO_LINK_CATEGORIES . " l2lc where l.links_id = ld.links_id AND ld.links_id = lf.links_id AND l.links_id = l2lc.links_id AND lf.expires_date >= now() AND l2lc.link_categories_id = '" . (int)$current_category_id . "' order by RAND()" );

 

if (tep_db_num_rows($link_featured_cat_query) > 0) {

$lf = tep_db_fetch_array($link_featured_cat_query);

 

if (LINKS_TITLES_AS_LINKS == 'True')

$link_featured_cat = $lf['links_title'];

else

$link_featured_cat = '<a href="' . tep_get_links_url($lf['links_id']) . '" target="_' . $openMode . '">' . $lf['links_title'] . '</a>';

 

if (LINK_LIST_IMAGE > 0)

{

if (tep_not_null($lf['links_image_url'])) {

$link_featured_cat .= '<br><a href="' . tep_get_links_url($lf['links_id']) . '" target="_' . $openMode . '">' . tep_links_image($lf['links_image_url'], $lf['links_title'], LINKS_IMAGE_WIDTH, LINKS_IMAGE_HEIGHT) . '</a>';

} else {

$link_featured_cat .= '<br><a href="' . tep_get_links_url($lf['links_id']) . '" target="_' . $openMode . '">' . tep_image(DIR_WS_IMAGES . 'pixel_trans.gif', $lf['links_title'], LINKS_IMAGE_WIDTH, LINKS_IMAGE_HEIGHT, 'style="border: 3px double black"') . '</a>';

}

}

if (LINK_LIST_DESCRIPTION > 0)

$link_featured_cat .= '<br>' . $lf['links_description'];

}

}

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<title><?php echo TITLE; ?></title>

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

<link rel="stylesheet" type="text/css" href="stylesheet.css">

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

 

<!-- body //-->

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

<tr>

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

</table></td>

<!-- body_text //-->

<?php

if ($display_mode == 'categories') {

?>

<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

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

<tr>

<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

<td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_default.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td><?php echo TEXT_MAIN_CATEGORIES; ?></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<?php if (tep_not_null($link_featured)) { ?>

<tr>

<td class="linkFeatured"><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td align="center"><?php echo TEXT_FEATURED_HEADING; ?></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td align="center"><?php echo $link_featured; ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<?php } ?>

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<?php

$categories_query = tep_db_query("select lc.link_categories_id, lcd.link_categories_name, lcd.link_categories_description, lc.link_categories_image from " . TABLE_LINK_CATEGORIES . " lc, " . TABLE_LINK_CATEGORIES_DESCRIPTION . " lcd where lc.link_categories_id = lcd.link_categories_id and lc.link_categories_status = '1' and lcd.language_id = '" . (int)$languages_id . "' order by lcd.link_categories_name");

 

$number_of_categories = tep_db_num_rows($categories_query);

 

if ($number_of_categories > 0) {

$rows = 0;

while ($categories = tep_db_fetch_array($categories_query)) {

$rows++;

$lPath_new = 'lPath=' . $categories['link_categories_id'];

$width = (int)(100 / MAX_DISPLAY_CATEGORIES_PER_ROW) . '%';

 

echo ' <td align="center" class="smallText" width="' . $width . '" valign="top"><a href="' . tep_href_link(FILENAME_LINKS, $lPath_new) . '">';

 

if (SHOW_LINKS_CATEGORIES_IMAGE == 'True') {

if (tep_not_null($categories['link_categories_image'])) {

echo tep_links_image(DIR_WS_IMAGES . $categories['link_categories_image'], $categories['link_categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '<br>';

} else {

echo ''; //tep_image(DIR_WS_IMAGES . 'pixel_trans.gif', $categories['link_categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT, 'style="border: 3px double black"') . '<br>';

}

}

 

$categories_count_query = tep_db_query("select link_categories_id from " . TABLE_LINKS_TO_LINK_CATEGORIES . " where link_categories_id = " . $categories['link_categories_id']);

$linkCount = tep_db_num_rows($categories_count_query);

echo '<br><b><u>' . $categories['link_categories_name'] . '</b></u></a> ' . '(' . $linkCount . ')<br>' . $categories['link_categories_description'] . '</td>' . "\n";

if ((($rows / MAX_DISPLAY_CATEGORIES_PER_ROW) == floor($rows / MAX_DISPLAY_CATEGORIES_PER_ROW)) && ($rows != $number_of_categories)) {

echo ' </tr>' . "\n";

echo ' <tr>' . "\n";

}

}

} else {

?>

<td><?php new infoBox(array(array('text' => TEXT_NO_CATEGORIES))); ?></td>

<?php

}

?>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

<tr class="infoBoxContents">

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

<td align="right" align="center"><?php echo tep_draw_form('check_links', tep_href_link(FILENAME_LINKS, '', 'NONSSL'), 'post', 'onSubmit="return true;" onReset="return true"') . tep_draw_hidden_field('action_search', 'process'); ?>

Search <?php echo tep_draw_input_field('links_search', '', 'maxlength="255", size="30"', false) . tep_image_submit('button_quick_find.gif', SEARCH) ; ?>

</form></td>

<td class="main" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_LINKS_SUBMIT, tep_get_all_get_params()) . '">' . tep_image_button('button_submit_link.gif', IMAGE_BUTTON_SUBMIT_LINK) . '</a>'; ?></td>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td><?php include(DIR_WS_MODULES . FILENAME_LINK_SEARCH); ?></td>

</tr>

</table></td>

</tr>

</table></td>

<?php

} elseif ($display_mode == 'links') {

// create column list

$define_list = array('LINK_LIST_TITLE' => LINK_LIST_TITLE,

'LINK_LIST_URL' => LINK_LIST_URL,

'LINK_LIST_IMAGE' => LINK_LIST_IMAGE,

'LINK_LIST_DESCRIPTION' => LINK_LIST_DESCRIPTION,

'LINK_LIST_COUNT' => LINK_LIST_COUNT);

 

asort($define_list);

 

$column_list = array();

reset($define_list);

while (list($key, $value) = each($define_list)) {

if ($value > 0) $column_list[] = $key;

}

 

$select_column_list = '';

 

for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {

switch ($column_list[$i]) {

case 'LINK_LIST_TITLE':

$select_column_list .= 'ld.links_title, ';

break;

case 'LINK_LIST_URL':

$select_column_list .= 'l.links_url, ';

break;

case 'LINK_LIST_IMAGE':

$select_column_list .= 'l.links_image_url, ';

break;

case 'LINK_LIST_DESCRIPTION':

$select_column_list .= 'ld.links_description, ';

break;

case 'LINK_LIST_COUNT':

if (ENABLE_LINKS_COUNT == 'True') {

$select_column_list .= 'l.links_clicked, ';

} else {

continue;

}

break;

}

}

 

// show the links in a given category

// We show them all

$listing_sql = "select " . $select_column_list . " l.links_id from " . TABLE_LINKS_DESCRIPTION . " ld, " . TABLE_LINKS . " l, " . TABLE_LINKS_TO_LINK_CATEGORIES . " l2lc where ( l.links_status = '2' or l.links_status = '4' ) and l.links_id = l2lc.links_id and ld.links_id = l2lc.links_id and ld.language_id = '" . (int)$languages_id . "' and l2lc.link_categories_id = '" . (int)$current_category_id . "'";

 

if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {

for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {

if ($column_list[$i] == 'LINK_LIST_TITLE') {

$HTTP_GET_VARS['sort'] = $i+1 . 'a';

$listing_sql .= " order by ld.links_title";

break;

}

}

} else {

$sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1);

$sort_order = substr($HTTP_GET_VARS['sort'], 1);

$listing_sql .= ' order by ';

switch ($column_list[$sort_col-1]) {

case 'LINK_LIST_TITLE':

$listing_sql .= "ld.links_title " . ($sort_order == 'd' ? 'desc' : '');

break;

case 'LINK_LIST_URL':

$listing_sql .= "l.links_url " . ($sort_order == 'd' ? 'desc' : '') . ", ld.links_title";

break;

case 'LINK_LIST_IMAGE':

$listing_sql .= "ld.links_title";

break;

case 'LINK_LIST_DESCRIPTION':

$listing_sql .= "ld.links_description " . ($sort_order == 'd' ? 'desc' : '') . ", ld.links_title";

break;

case 'LINK_LIST_COUNT':

$listing_sql .= "l.links_clicked " . ($sort_order == 'd' ? 'desc' : '') . ", ld.links_title";

break;

}

}

?>

<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

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

<tr>

<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

<?php

// Get the right image for the top-right ;-)

$image = 'table_background_list.gif';

if ($current_category_id) {

$image_query = tep_db_query("select link_categories_image from " . TABLE_LINK_CATEGORIES . " where link_categories_id = '" . (int)$current_category_id . "'");

$image_value = tep_db_fetch_array($image_query);

 

if (tep_not_null($image_value['link_categories_image'])) {

$image = $image_value['link_categories_image'];

}

}

?>

<td align="right"><?php echo tep_links_image(DIR_WS_IMAGES . $image, HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td><?php include(DIR_WS_MODULES . FILENAME_LINK_LISTING); ?></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

<tr class="infoBoxContents">

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

<td class="main" align="left"><?php echo '<a href="' . tep_href_link(FILENAME_LINKS, '') . '">' . tep_image_button('button_categories.gif', 'Link Categories') . '</a>'; ?></td>

<td align="right" align="center"><?php echo tep_draw_form('check_links', tep_href_link(FILENAME_LINKS, 'lPath=1', 'NONSSL'), 'post', 'onSubmit="return true;" onReset="return true"') . tep_draw_hidden_field('action_search', 'process'); ?>

Search <?php echo tep_draw_input_field('links_search', '', 'maxlength="255", size="30"', false) . tep_image_submit('button_quick_find.gif', SEARCH); ?>

</form></td>

<td class="main" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_LINKS_SUBMIT, tep_get_all_get_params()) . '">' . tep_image_button('button_submit_link.gif', IMAGE_BUTTON_SUBMIT_LINK) . '</a>'; ?></td>

<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td><?php include(DIR_WS_MODULES . FILENAME_LINK_SEARCH); ?></td>

</tr>

</table></td>

<?php

}

?>

<!-- body_text_eof //-->

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- right_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>

<!-- right_navigation_eof //-->

</table></td>

</tr>

</table>

<!-- body_eof //-->

 

<!-- footer //-->

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

<!-- footer_eof //-->

<br>

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>


Scott Lawry

Share this post


Link to post
Share on other sites

Hi!

 

It looks like an useful contribution. I'd like to install it, but hesitate somewhat... Are there any risk involved that previous installed contributions will collide with this one, already busy coniguration ID:s and so forth?

 

TIA

kbking

Share this post


Link to post
Share on other sites

I don't know what you mean by "already busy confguration id's" but, if installed properly, Links Manager works fine with all other contributions. At least, no one has ever mentioned a compatibility problem that I am aware of.

 

Jack

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×