Page 4 of 16 FirstFirst ... 2345614 ... LastLast
Results 31 to 40 of 156
  1. #31
    Join Date
    May 2008
    Posts
    26
    Plugin Contributions
    0

    Default Re: Image Titles Support Thread

    Very hard to read, especially word-wrapped, since I already looked for that. Thanks a lot for pointing it out. I wouldn't want to make it work as html either. Anyway, that worked for the center box.

    I've been chewing on the cat tabs this evening. I used your instructions for product info display from the readme as a base. I located tpl_modules_categories_tabs.php using the developer toolkit, and armed with my virtually nonexistent knowledge of php attempted to make images happen.

    If you wouldn't mind my picking your brain I'd love to see if what I'm trying to do is even sane.

    Thanks again

  2. #32
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Image Titles Support Thread

    Sure, post the file as you have it (in [php] and [/php] tags) and describe what you did, and I'll see what I can do.
    Last edited by gjh42; 15 May 2008 at 06:28 AM.

  3. #33
    Join Date
    May 2008
    Posts
    26
    Plugin Contributions
    0

    Default Re: Image Titles Support Thread

    Well. after sleeping on it, I got it to work. I don't know that it's efficient or bulletproof, but it functions. It also could use a rollover, but that's a disaster I'm not sure I want to think about at the moment

    So I located tpl_modules_categories_tabs by hunting the div in the dev toolkit. I split the output of $links_list[$i] into two variables:

    $cathref - all of <a href blah>

    $catname - just the text of the category name

    I took your "prodname" example from the image titles readme as a base, and changed the expected filename to "cattab- . $catname". I kept your conditional intact and simply changed the output to wrap it in "$cathref" and "</a>"

    Like i say, it works. It seems that there ought to be a better way to parse the URL though, that doesn't hang on hardcoded math like this. I also had the thought to lowercase the catname, but it wouldn't make the file completely case-insensitive, so I didn't bother.


    PHP Code:

    <?php

    /**

     * Module Template - categories_tabs

     *

     * Template stub used to display categories-tabs output

     *

     * @package templateSystem

     * @copyright Copyright 2003-2005 Zen Cart Development Team

     * @copyright Portions Copyright 2003 osCommerce

     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0

     * @version $Id: tpl_modules_categories_tabs.php 3395 2006-04-08 21:13:00Z ajeh $

     */



      
    include(DIR_WS_MODULES zen_get_module_directory(FILENAME_CATEGORIES_TABS));

    ?>

    <?php if (CATEGORIES_TABS_STATUS == '1' && sizeof($links_list) >= 1) { ?>

    <div id="navCatTabsWrapper">

    <div id="navCatTabs">

    <ul>

    <?php for ($i=0$n=sizeof($links_list); $i<$n$i++) { ?>

      <li><?php
        $catlink 
    $links_list[$i];
        
    $posgt strpos($catlink'>'); //position of greater than in html
        
    $posnlt strpos($catlink'<'$posgt); //position of less than after greater than
        
    $cathref substr($catlink0, ($posgt 1)); //href portion of link for rewrite
        
    $catname substr($catlink, ($posgt 1), -5); //cat name for image
        
    echo (file_exists(DIR_WS_TEMPLATE 'buttons/' $_SESSION['language'] . '/cattab-' $catname '.gif')) ? $cathref zen_image(DIR_WS_TEMPLATE 'buttons/' $_SESSION['language'] . '/cattab-' $catname '.gif') . "</a>" $links_list[$i];
    ?></li>

    <?php ?>

    </ul>

    </div>

    </div>

    <?php ?>

  4. #34
    Join Date
    May 2008
    Posts
    26
    Plugin Contributions
    0

    Default Re: Image Titles Support Thread

    Hrmm.... not bulletproof at all. Just got back to poking at it, and when one of them is clicked list_links outputs a span class, which completely throws off the code to separate the category name...

    So the file check returns false and the selected button is replaced by the original text equivalent. Like I say, there has to be a better way of parsing that URL.

    Additionally, since I posted earlier I've noticed that my $posnlt isn't being used. It was originally intended to help cut out the category name before I recalled that substr() takes start and length, not start and end.

    One other thing I've been meaning to mention, I saw you comment in another thread that the directions here are misleading, and I would agree as I spent quite a bit of time trying to make things work along those lines. Where do we go to suggest that it be removed/modified?

  5. #35
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Image Titles Support Thread

    Good for you! That looks effective, with one question: what happens if the cat name is two words with a space? I haven't gone back to the original code or to ZC functions to see exactly what string is involved or if this is addressed in the basic code.
    Oh well, I guess some more work will be needed...

    I agree it would be nice to get a more elegant method of splitting out the name.

  6. #36
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Image Titles Support Thread

    The tutorial bit has been bugging me. I saw one of the devs (Kim or DrByte, can't remember which) mention that that one (written by a volunteer) had not been vetted closely enough and ought to be removed or replaced with the "redefine" instructions they gave, but I haven't been able to locate that post since then.

    There is one flaw in the otherwise elegant method of defining the heading as an image, which is that some of the headings that are links have a " [more]" appended in the code which would not be replaced by the defined image. The [more] can be defined to blank, but can't cover different contents for different situations.

    At any rate, any of the devs can do this.
    Last edited by gjh42; 15 May 2008 at 07:17 PM.

  7. #37
    Join Date
    May 2008
    Posts
    26
    Plugin Contributions
    0

    Default Re: Image Titles Support Thread

    Actually if the category name had a space it would return properly in this code, except the space would throw off the filename... that would be easy enough to strip out though. The bigger question is what to do with additional tags... I chose ">" as the search string because I hoped it would be unique. That span tag adds another, so the whole calculation goes off.

    You'd think php would have a more direct way of saying "the word between the tags" to extract $catname, theoretically you'd have a reverse function then that could say "put $imagecode between the tags".... if only life were so easy

  8. #38
    Join Date
    May 2008
    Posts
    26
    Plugin Contributions
    0

    Default Re: Image Titles Support Thread

    Alright, back, with robustness. After some discussion with a friend, I settled on searching for '">' as the unique. I considered getting a total of '>' occurences and dividing by 2 to get the right one, but he pointed out that '>' in the catname would screw that up.

    So, now we hunt '">' and '</' as the cutoffs:

    $posgt gets the *last* occurrence of '">' using strrpos

    $posnlt gets a new lease on life in order to calculate the length from the end for use with substr (eliminates that nasty hardcoded -5 that failed anyway in the presence of the span)

    $catname is now subjected to trim() to eliminate that white space problem you mentioned.

    The only remaining hardcoded number is the +2 to move $posgt past the '">' in question, and it's now part of the variable instead of being added in the substr.

    And so it works... any other gaping holes?

    PHP Code:
    <?php

    /**

     * Module Template - categories_tabs

     *

     * Template stub used to display categories-tabs output

     *

     * @package templateSystem

     * @copyright Copyright 2003-2005 Zen Cart Development Team

     * @copyright Portions Copyright 2003 osCommerce

     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0

     * @version $Id: tpl_modules_categories_tabs.php 3395 2006-04-08 21:13:00Z ajeh $

     */



      
    include(DIR_WS_MODULES zen_get_module_directory(FILENAME_CATEGORIES_TABS));

    ?>

    <?php if (CATEGORIES_TABS_STATUS == '1' && sizeof($links_list) >= 1) { ?>

    <div id="navCatTabsWrapper">

    <div id="navCatTabs">

    <ul>

    <?php for ($i=0$n=sizeof($links_list); $i<$n$i++) { ?>

      <li><?php
        $catlink 
    $links_list[$i];
        
    $posgt = (strrpos($catlink'">') + 2); //position of last greater than in html
        
    $posnlt strpos($catlink'</'$posgt); //position of less than after greater than
        
    $lenend = (strlen($catlink) - $posnlt);
        
    $cathref substr($catlink0$posgt); //href portion of link for rewrite
        
    $catname trim(substr($catlink$posgt, -($lenend))); //cat name for image
        
    echo (file_exists(DIR_WS_TEMPLATE 'buttons/' $_SESSION['language'] . '/cattab-' $catname '.gif')) ? $cathref zen_image(DIR_WS_TEMPLATE 'buttons/' $_SESSION['language'] . '/cattab-' $catname '.gif') . "</a>" $links_list[$i];
    ?></li>

    <?php ?>

    </ul>

    </div>

    </div>

    <?php ?>

  9. #39
    Join Date
    May 2008
    Posts
    14
    Plugin Contributions
    0

    Default Re: Image Titles Support Thread

    Has anyone tried to get this mod to change the EZ pages on the top nav area to images? What would I name the image files to get it to see them?

    Thanks!

  10. #40
    Join Date
    Mar 2008
    Location
    Gouda, Netherlands
    Posts
    213
    Plugin Contributions
    1

    Default Re: Image Titles Support Thread

    I read about this mod in the categories dressing support thread and I have a few questions.

    * Can this be used in combination with categories dressing?
    * Is version 1.1 or 1.2 recommended on zc 1.3.7. ?
    * How do you determin which size a text replacement image is supposed to be?

    Thank you in advance!
    Working on http://www.skull-shop.net once again.

 

 
Page 4 of 16 FirstFirst ... 2345614 ... LastLast

Similar Threads

  1. v150 Image Handler 4 (for v1.5.x) Support Thread
    By DivaVocals in forum All Other Contributions/Addons
    Replies: 1687
    Last Post: 17 Nov 2024, 07:26 PM
  2. Rotating Image Slider [Support Thread]
    By picaflor-azul in forum All Other Contributions/Addons
    Replies: 21
    Last Post: 8 Jun 2018, 02:16 AM
  3. v139h Image Handler 3 Support Thread (for ZC v1.3.9)
    By DivaVocals in forum All Other Contributions/Addons
    Replies: 1095
    Last Post: 2 Oct 2017, 12:42 PM
  4. AJAX IMAGE Swapper support thread
    By jaycode in forum All Other Contributions/Addons
    Replies: 785
    Last Post: 13 Jan 2016, 11:48 PM
  5. Additional Image Titles [support]
    By gjh42 in forum All Other Contributions/Addons
    Replies: 67
    Last Post: 16 Sep 2011, 04:28 AM

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