Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2016
    Location
    Suffolk VA
    Posts
    590
    Plugin Contributions
    0

    Default Clickable image on main page

    I'm about ready to go live, and would like to put a clickable image on the main page to replace the static image I have there now. I know how to create a clickable image, and I think I've found the proper place to put the code, but I don't have a clue yet about how to wrap the code in a PHP command.

    I think it needs to go in /includes/templates/template_default/templates/tpl_index_default.php around line 39. If anyone can help out with that, it would be very much appreciated.

  2. #2
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    9,144
    Plugin Contributions
    11

    Default Re: Clickable image on main page

    Short on time. Just wanted to say that each new thread should be treated as if you are dealing with the hosting company's low level techy with the flow chart.
    Every bit of information you give at the start gets to the solution much quicker. All those posting tips and WHICH image (in this case) prevents us having to search through posts for a link, go to the link, try to figure out WHICH static image, etc.

  3. #3
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Clickable image on main page

    Quote Originally Posted by HeleneWallis View Post
    /includes/templates/template_default/templates/tpl_index_default.php
    Almost.
    *IF* that were the file to change, then you would actually change THIS file:
    /includes/templates/YOUR_TEMPLATE_FOLDERNAME_HERE/templates/tpl_index_default.php
    ... and if you don't already have that file, then COPY it from template_default, and edit the copy.


    But, since you quoted line 39 that suggests that you're referring to code that's being output from the Define Page. And you can edit Define Pages in Admin->Tools->Define Pages Editor.
    Then simply provide the requisite HTML to make the image clickable (you said you already know how to do that).
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  4. #4
    Join Date
    Jun 2016
    Location
    Suffolk VA
    Posts
    590
    Plugin Contributions
    0

    Default Re: Clickable image on main page

    Thanks, I'll have a look at the define pages. Should have thought of that. I'd forgotten that the main page can be accessed through the admin panel.

  5. #5
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: Clickable image on main page

    First of all, to save yourself on future upgrades, the file changes should not be made to files in the template_default directory but instead the file should be copied to your template's directory and then modified from there.

    As to adding the click portion to the image, you'll be adding an <a tag before the declaration/echo of the image and a closing </a> tag at an html validation point after the image. Here is the code around line 39 of the referenced file starting at line 28:
    Code:
    <!-- deprecated - to use uncomment this section
    <?php if (TEXT_INFORMATION) { ?>
    <div id="" class="content"><?php echo TEXT_INFORMATION; ?></div>
    <?php } ?>-->
    
    <?php if (DEFINE_MAIN_PAGE_STATUS >= 1 and DEFINE_MAIN_PAGE_STATUS <= 2) { ?>
    <?php
    /**
     * get the Define Main Page Text
     */
    ?>
    <div id="indexDefaultMainContent" class="content"><?php require($define_page); ?></div>
    <?php } ?>
    With this being line 39:
    Code:
    <div id="indexDefaultMainContent" class="content"><?php require($define_page); ?></div>
    So if you wanted an image to appear before this content (so that it at the top) then you could add the following just before than line/moving that line down:
    Code:
    <a href="<?php echo zen_href_link('main_page_name', 'parameters', $request_type); ?>" ><?php echo zen_image('path_to_image', 'alt_text', 'image_width_if_desired', 'image_height_if_desired', 'parameters_if_desired'); ?>
    This would provide a little dynamic capability to the site such that if the code and files of this site are moved elsewhere, then the links and images should still function normally.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  6. #6
    Join Date
    Jun 2016
    Location
    Suffolk VA
    Posts
    590
    Plugin Contributions
    0

    Default Re: Clickable image on main page

    Thanks very much! I realized after posting that this should be done in my own template directory. But it looks like using the Define Pages Editor will work just fine for this particular application. The code tutorial helps anyway. I'll eventually get my head wrapped around PHP. Just don't have time right now.

 

 

Similar Threads

  1. Clickable Background image
    By Lazar in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 16 Feb 2017, 02:42 PM
  2. v139h Main Page: "New" Products - turn off clickable link and DISPLAY new products
    By lissa in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 28 Sep 2014, 02:20 AM
  3. How to Do a Clickable Slideshow on Main Page?
    By hcd888 in forum General Questions
    Replies: 9
    Last Post: 5 Jun 2009, 08:33 AM
  4. clickable links in main product listing page, possible?
    By modchipfitters.co.uk in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 13 Jul 2008, 08:33 PM
  5. Clickable image in Product info page
    By marksimo in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 11 Mar 2007, 08:56 AM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR