Jump to content
Sign in to follow this  
zathrus

Links Manager Question

Recommended Posts

Hi everyone

 

I'm not sure if this is a bug, or a user mistake in adding the links, or if the script just isn't behaving how "I thought it would." (the words of doom in a programmers world)

 

All the links look fine in the database www.whatever.com (I hope that's a real site someday) but on the site they show up with the extra path of http://sitethat-we-arebuilding.com/catalog...ww.whatever.com

 

I installed the patch, but it doesn't change this.

I looked through the code a while too and my eyes have not opened yet you could say.

 

Has anyone run into this problem before? It's consistant with every link added, but the value stored in the database and when you check the admin is correct. (so it's coming from the display probably from catalog/exchange_links.php)

 

Thanks anyone for your help.

Jonathan

Share this post


Link to post
Share on other sites

<?php

   $link_link_query = tep_db_query("select l.link_title, l.link_description, l.link_url, c.link_category_name from " . TABLE_EXCHANGE_LINKS_LINKS . " l, " . TABLE_EXCHANGE_LINKS_CATEGORIES . " c where l.link_category_id = c.link_category_id and c.link_category_id = '" . $lPath . "' and l.link_status = '1' order by l.link_title");

   //$link_link_query = tep_db_query("select * from " . TABLE_EXCHANGE_LINKS_LINKS . " l where l.link_category_id = '" . $lPath .  "'");



   echo '          <tr>' . "n";

   echo '            <td><table border="0" width="100%" cellspacing="0" cellpadding="2">' . "n";



   //links under category

   $rows = 0;

   while($link_links_data = tep_db_fetch_array($link_link_query)) {

     $rows++;

     if($rows == 1) {

       echo '              <tr>' . "n";

       echo '                <td align="left" class="smallText" style="width: ' . $width . '" valign="top"><a name="' . $link_links_data['link_category_id'] . '"></a><br> :: <a href="' . tep_href_link(FILENAME_EXCHANGE_LINKS . '#' . $link_links_data['link_category_id'], '', NONSSL, false) . '" class="subCatLinks">' . $link_links_data['link_category_name'] . '</a></td>' . "n";

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

     }



     echo '              <tr>' . "n";

     echo '                <td align="left" class="smallText" style="width: ' . $width . '" valign="top"><br> » <a href="' . $link_links_data['link_url'] . '" class="exLinkTitle" target="_blank">' . $link_links_data['link_title'] . '</a><br><div align="justify">' . $link_links_data['link_description'] . '</div><a href="' . $link_links_data['link_url'] . '" class="exLinkURL" target="_blank">' . $link_links_data['link_url'] . '</a></td>' . "n";

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

   }

?>

This is the section from catalog/exchange_links.php that displays the list of links. Have you worked with this module before? This looks like the problem might be in another file (at first glance anyway)

 

More specifically (from exchange_links.php) this line would be it if this file was the problem.

right from <a href to >

 <td align="left" class="smallText" style="width: ' . $width . '" valign="top"><br> » <a href="' . $link_links_data['link_url'] . '" class="exLinkTitle" target="_blank">' . $link_links_data['link_title'] . '</a><br><div align="justify">' . $link_links_data['link_description'] . '</div><a href="' . $link_links_data['link_url'] . '" class="exLinkURL" target="_blank">' . $link_links_data['link_url'] . '</a></td>' . "n";

Share this post


Link to post
Share on other sites

Okay...one more request. :) Is there a URL where I can see the output while I'm looking at the code?

 

It has bee a long time since I added a links manager to my site ...I am not sure this is the same one I have....What contrib is this?


Kim

~~~~~~~~~~~~~

Share this post


Link to post
Share on other sites

Well, I was about to post but I just figured it out (took long enough)

 

I wonder what you had in mind though.

$Id: exchange_links.php, v0.2 2003/05/02 Exp $

 

Links Manager for OSC v0.2

line 192

The specific line I thought it might be

adding

http://

between the double and single quotes,

 

 <a href"'http://' rest of the code

Did it for both links in that row and it works fine

 

Weird

(no wonder silly couldn't find it, I was looking for a php error, but it was an html error)

Hmm, do we let the author know?

 

thanks for the replies

I appreciate it

Share this post


Link to post
Share on other sites

http://www.salehut.com

 

That's the site listed by the contributor.

VERY nice site. Like the menu's.

 

Not to mention my thanks to the author for providing an addon with detailed instructions that were easy to follow.

Share this post


Link to post
Share on other sites

Congratulations Jonathan! Good job on fixing your problem.

 

If you haven't already, I would get in touch with the author and let him know what you have found.


Kim

~~~~~~~~~~~~~

Share this post


Link to post
Share on other sites

Hi Jonathan,

 

Oops, sorry I joined in a bit late. Thanks a whole lot for taking time to look into the code.

 

Actually, the problem lies in the user adding the links... they're supposed to include the 'http://' prefixed to the url they submit. I think the following code change would make sure they add the 'http://' before the url. At least, it would act as a reminder, till I can come up with some url validation code.

 

In file /catalog/includes/modules/link_submit_details.php,

 

at around line 50, replace

  if ($is_read_only == true) {

   echo $submit_link['link_address'];

 } elseif ($error == true) {

   if ($entry_url_error == true) {

     echo tep_draw_input_field('url') . ' ' . ENTRY_LINKS_ADDRESS_ERROR;

   } else {

     echo $url . tep_draw_hidden_field('url');

   }

 } else {

   echo tep_draw_input_field('url', $submit_link['link_address']) . ' ' . ENTRY_LINKS_ADDRESS_TEXT;

 }

 

with,

 

  if ($is_read_only == true) {

   echo $submit_link['link_address'];

 } elseif ($error == true) {

   if ($entry_url_error == true) {

     echo tep_draw_input_field('url') . ' ' . ENTRY_LINKS_ADDRESS_ERROR;

   } else {

     echo $url . tep_draw_hidden_field('url');

   }

 } else {

   echo tep_draw_input_field('url', 'http://' . $submit_link['link_address']) . ' ' . ENTRY_LINKS_ADDRESS_TEXT;

 }

 

 

and at around line 155, replace

 

  if ($is_read_only == true) {

   echo $submit_link['link_reciprocal'];

 } elseif ($error == true) {

   if ($entry_reciprocal_error == true) {

     echo tep_draw_input_field('reciprocal') . ' ' . ENTRY_LINKS_RECIPROCAL_PAGE_ERROR;

   } else {

     echo $reciprocal . tep_draw_hidden_field('reciprocal');

   }

 } else {

   echo tep_draw_input_field('reciprocal', $submit_link['link_reciprocal']) . ' ' . ENTRY_LINKS_RECIPROCAL_PAGE_TEXT;

 }

 

with,

 

  if ($is_read_only == true) {

   echo $submit_link['link_reciprocal'];

 } elseif ($error == true) {

   if ($entry_reciprocal_error == true) {

     echo tep_draw_input_field('reciprocal') . ' ' . ENTRY_LINKS_RECIPROCAL_PAGE_ERROR;

   } else {

     echo $reciprocal . tep_draw_hidden_field('reciprocal');

   }

 } else {

   echo tep_draw_input_field('reciprocal', 'http://' . $submit_link['link_reciprocal']) . ' ' . ENTRY_LINKS_RECIPROCAL_PAGE_TEXT;

 }

 

You can see the code in action at, http://www.salehut.com/exchange_links_submit.php

 

Thanks again :-),

VJ

Share this post


Link to post
Share on other sites

thanks

I'll need to put that in.

and put a nice reminder in for all future users (....... grrrr)

 

probably won't play with this again until monday

 

thanks a lot vj (are you the contributor?)

 

Jonathan

Share this post


Link to post
Share on other sites

Yep, I made this contribution with code fixes and help from quite a few others... including you :).

 

Thanks,

VJ

Share this post


Link to post
Share on other sites

VJ

 

Where exactly would I apply the http:// update in the admin > links > new links page?

 

Currently site URL and reciprocol page would cause issues if the entry was made with http:// prefix omitted.

 

Can't find the equivalent to

/catalog/includes/modules/link_submit_details.php

in the admin section...

 

It is not a major issue as it is admin only but a would be nice to have.

 

Thanks


The pleasure has been all mine.

Share this post


Link to post
Share on other sites
Hi everyone

 

I'm not sure if this is a bug, or a user mistake in adding the links, or if the script just isn't behaving how "I thought it would."  (the words of doom in a programmers world)

 

All the links look fine in the database www.whatever.com (I hope that's a real site someday) but on the site they show up with the extra path of http://sitethat-we-arebuilding.com/catalog...ww.whatever.com

 

It's real!! Point you browser to www.whatever.com. I was redirected to www.beargear.com. Cool! :lol:

 

Regards,

Piotr

Share this post


Link to post
Share on other sites
Where exactly would I apply the http:// update in the admin > links > new links page?  

 

Here's a quickfix you could try:

 

In /admin/exchange_links_links.php,

 

replace this code (around line 235),

 

            <td class="main"><?php echo tep_draw_input_field('link_url', $cInfo->link_url, 'maxlength="255"', true); ?></td>

 

with,

 

            <td class="main"><?php echo tep_draw_input_field('link_url', (isset($cInfo->link_url)) ? $cInfo->link_url : 'http://', 'maxlength="255"', true); ?></td>

 

and this code (around line 280),

 

            <td class="main"><?php echo tep_draw_input_field('link_reciprocal', $cInfo->link_reciprocal, 'maxlength="255"'); ?></td>

 

with,

 

            <td class="main"><?php echo tep_draw_input_field('link_reciprocal', (isset($cInfo->link_reciprocal)) ? $cInfo->link_reciprocal : 'http://', 'maxlength="255"'); ?></td>

 

By the way, I'm working on a newer version of this links program now. I hope to get it done in a couple of weekends (hopefully!).

 

HTH,

VJ

Share this post


Link to post
Share on other sites

VJ,

Now we are both on the same song sheet :wink:

 

The admin http:// inclusions work perfectly.

Perhaps an inclusion for your next release?

 

You are a superstar, thanks for this contribution and your assistance.

 

Thomas


The pleasure has been all mine.

Share this post


Link to post
Share on other sites

I just tried to install this and in admin Im getting all kinds of erroes..

 

Right now Im getting this

When clicking:

 

LINKS:

 

Site Title Status Action

TEXT_DISPLAY_NUMBER_OF_RECS Page 0 of 0

ALso the Add Link? Image isn't in the package..

 

Categories

 

Link Categories Search:

Name Status Action

Fatal error: Call to undefined function: tep_array_merge() in /usr/local/psa/home/vhosts/stoprust.net/httpdocs/admin/exchange_links_categories.php on line 296

 

 

Help ?

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  

×