Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Information box items - highlighting


jpipitone43

Recommended Posts

Posted

Inside the "Information Box" there are a variety of links such as Shipping & Returns, Privacy Notice, Conditions of Use, and Contact Us.

 

Is there a contribution out there, or is there a way to highlight such items, or bold them, when a link is clicked and that page is displayed? I'd like to create an "About Us" page, among others (Feedback, Press, affiliates, etc) and when that link is clicked on, I'd like to be able to bold an item or show which page is currently active.

 

Is there a way to do this? I've found the contribution that allows me to replace the category items with images, but that only works with Category items, not individual content pages.

 

Thanks for your help!

Posted

The items in the Information boxes are hard-linked to their names, so you can call the url to the file name and use what's returned to use inline CSS to bold the link. Here's one way. The code is in the includes/boxes/information.php file. substitue the code below in place of what's between the php tags.

 

<?php
 $curPageName = substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1);   //GET THE CURRENT PAGE
  if ($curPageName == 'shipping.php')                                                     // CHECK CURRENT PAGE AND APPLY STYLE TO CORRECT CLASS
   {echo '<style type="text/css">.shipping {font-weight:bold}</style>';}
  elseif ($curPageName == 'privacy.php')
   {echo '<style type="text/css">.privacy {font-weight:bold}</style>';}
  elseif ($curPageName == 'contact_us.php')
   {echo '<style type="text/css">.contact {font-weight:bold}</style>';}
  else
   {echo '<style type="text/css">span {font-weight:normal}</style>';}
 $info_box_contents = array();
 $info_box_contents[] = array('text' => BOX_HEADING_INFORMATION);

 new infoBoxHeading($info_box_contents, false, false);

 $info_box_contents = array();
 $info_box_contents[] = array('text' =>
 '<span class="shipping"><a href="' . tep_href_link(FILENAME_SHIPPING) . '">' . BOX_INFORMATION_SHIPPING . '</a></span><br>' .   //ADD CLASS TO LINK USING SPAN
 '<span class="privacy"><a href="' . tep_href_link(FILENAME_PRIVACY) . '">' . BOX_INFORMATION_PRIVACY . '</a></span><br>' .
 '<span class="contact"><a href="' . tep_href_link(FILENAME_CONTACT_US) . '">' . BOX_INFORMATION_CONTACT . '</a></span>');

 new infoBox($info_box_contents);
?>>

 

Basically, from the first line, you use 'substr' to extract the just the filename from the url. Then from the second to tenth lines you use a conditional statement set to check the extracted filename against whatever the linked filename is that you can find in includes/filenames.php. If you look down in the $info_box_contents array you can find those references, or you can just right-click on the link in your browser and look in properties. Finally, down where the anchors are, you just put a classes span before the anchor. Neat thing is, you can do anything to the text using this method you can do with any CSS classed object (color, borders. backgrounds, including images).

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...