Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2008
    Posts
    98
    Plugin Contributions
    0

    Default Create New Products Header Link

    Rather than have the new products header on the home page simply say "New Products for the month...etc." I wanted to create a link in the header that would say something to the effect of "New Products...Click Here for Complete List."

    The good news...is that I was able to figure out how to do it...but the bad news is that given my limited knowledge of php, etc....I made the change by hard coding the changes into the new_products.php file. So I am wondering if someone could help me modify this so that I accomplish the same thing...but without the hard coding.

    First....here is the original portion of new_products.php that I addressed:

    Code:
    $title = '<h2 class="centerBoxHeading">' . sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')) . ($category_title != '' ? ' - ' . $category_title : '' ) . '</h2>';
        } else {
          $title = '<h2 class="centerBoxHeading">' . sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')) . '</h2>';
        }
    Then here is what I did to accomplish the change for the header to make it a link.

    Code:
    $title = '<h2 class="centerBoxHeading">' . '<a href="http://www.mywebsite.com/index.php?main_page=products_new" >Featured New Listings...Click Here for Complete List</a>' . ($category_title != '' ? ' - ' . $category_title : '' ) . '</h2>';
        } else {
          $title = '<h2 class="centerBoxHeading">' . '<a href="http://www.mywebsite.com/index.php?main_page=products_new" >Featured New Listings...Click Here for Complete List</a>' . '</h2>';
        }
    While this does what I want...it eliminates the reference to TABLE_HEADING_NEW_PRODUCTS and hard codes in the actual link to the new products page...things that I would like to avoid of course in case of future changes that I might want to make.

  2. #2
    Join Date
    Sep 2008
    Posts
    98
    Plugin Contributions
    0

    Default Re: Create New Products Header Link

    Well...after working on it some more...I figured out how to do it....

    I substituted the following text for the original version:

    Code:
    $title = '<h2 class="centerBoxHeading">' . '<a href="' . zen_href_link(FILENAME_PRODUCTS_NEW) . '">' . TABLE_HEADING_NEW_PRODUCTS . '</a>' . ($category_title != '' ? ' - ' . $category_title : '' ) . '</h2>';
        } else {
          $title = '<h2 class="centerBoxHeading">' . '<a href="' . zen_href_link(FILENAME_PRODUCTS_NEW) . '">' . TABLE_HEADING_NEW_PRODUCTS . '</a>' . ($category_title != '' ? ' - ' . $category_title : '' ) . '</h2>';
        }
    This creates a linkable header for the New Products center box that appears on the home page...and elsewhere...but does so without hard-coding the header link or the header title.

    Hope this helps others who may want to create such a link.

 

 

Similar Threads

  1. Create Account Header Link
    By sharc316 in forum General Questions
    Replies: 5
    Last Post: 7 Aug 2021, 09:41 AM
  2. Need manufacturers name as link on front page new products and new products listing
    By ladybugmom in forum Templates, Stylesheets, Page Layout
    Replies: 10
    Last Post: 27 Nov 2014, 08:43 AM
  3. v150 Create Account link in Header
    By Late Landing in forum General Questions
    Replies: 4
    Last Post: 13 Aug 2012, 10:23 PM
  4. Everytime I create a category it creates a link in the header
    By davalf in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 2 Jul 2011, 06:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg