Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17
  1. #11
    Join Date
    Apr 2010
    Posts
    884
    Plugin Contributions
    0

    Default Re: Trying to us html in a define... HELP PLEASE!

    Because of the div ID (<div id="navMainSearch" class="forward">), I tracked it to /includes/templates/mc001/templates/tpl_ezpages_bar_header.php.

    Here is the entire content of that file (very short; I've stripped out the copyright/general info from the top of these files):
    Code:
    <?php
      /**
       * require code to show EZ-Pages list
       */
      include(DIR_WS_MODULES . zen_get_module_directory('ezpages_bar_header.php'));
    ?>
    <?php if (sizeof($var_linksList) >= 1) { ?>
    <div id="navEZPagesTop">
    <div id="navMainSearch" class="forward"><?php require(DIR_WS_MODULES . 'sideboxes/search_header.php'); ?></div>
      <ul>
    <?php for ($i=1, $n=sizeof($var_linksList); $i<=$n; $i++) {  ?>
        <li><a href="<?php echo $var_linksList[$i]['link']; ?>"><?php echo $var_linksList[$i]['name']; ?></a></li>
    <?php } // end FOR loop ?>
      </ul>
    </div>
    <?php } ?>
    That led me to includes/modules/sideboxes/search_header.php:
    Code:
    <?php
    
      $search_header_status = $db->Execute("select layout_box_name from " . TABLE_LAYOUT_BOXES . " where (layout_box_status=1 or layout_box_status_single=1) and layout_template ='" . $template_dir . "' and layout_box_name='search_header.php'");
    
      if ($search_header_status->RecordCount() != 0) {
        $show_search_header= true;
      }
    
      if ($show_search_header == true) {
    
        require($template->get_template_dir('tpl_search_header.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_search_header.php');
    
        $title = '<label>' . BOX_HEADING_SEARCH . '</label>';
        $title_link = false;
        require($template->get_template_dir('tpl_box_header.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_box_header.php');
      }
    ?>
    That led me to tpl_search_header.php and tpl_box_header.php.

    Here is tpl_search_header.php:
    Code:
    <?php
      $content = "";
      $content .= zen_draw_form('quick_find_header', zen_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', $request_type, false), 'get');
      $content .= zen_draw_hidden_field('main_page',FILENAME_ADVANCED_SEARCH_RESULT);
      $content .= zen_draw_hidden_field('search_in_description', '1') . zen_hide_session_id();
    
      if (strtolower(IMAGE_USE_CSS_BUTTONS) == 'yes') {
        $content .= zen_draw_input_field('keyword', '', 'size="6" maxlength="30" style="width: 100px" placeholder="' . HEADER_SEARCH_DEFAULT_TEXT . '" onfocus="if (this.value == \'' . HEADER_SEARCH_DEFAULT_TEXT . '\') this.value = \'\';" onblur="if (this.value == \'\') this.value = \'' . HEADER_SEARCH_DEFAULT_TEXT . '\';"') . '&nbsp;' . zen_image_submit (BUTTON_IMAGE_SEARCH,HEADER_SEARCH_BUTTON);
      } else {
        $content .= zen_draw_input_field('keyword', '', 'size="6" maxlength="30" style="width: 100px" placeholder="' . HEADER_SEARCH_DEFAULT_TEXT . '" onfocus="if (this.value == \'' . HEADER_SEARCH_DEFAULT_TEXT . '\') this.value = \'\';" onblur="if (this.value == \'\') this.value = \'' . HEADER_SEARCH_DEFAULT_TEXT . '\';"') . '&nbsp;<input type="submit" value="' . HEADER_SEARCH_BUTTON . '" style="width: 45px" />';
      }
    
      $content .= "</form>";
    ?>
    And here is tpl_box_header.php:
    Code:
    <?php echo $content; ?>

  2. #12
    Join Date
    Apr 2010
    Posts
    884
    Plugin Contributions
    0

    Default Re: Trying to us html in a define... HELP PLEASE!

    Hey MC, I think I found the file where the buttons are being assembled!

    Here is /includes/functions/html_output.php (look for IMAGE_USE_CSS_BUTTONS):
    Code:
    Too long, won't let me post!
    If you don't happen to have a copy of zc155e I could post the file.

  3. #13
    Join Date
    Apr 2010
    Posts
    884
    Plugin Contributions
    0

    Default Re: Trying to us html in a define... HELP PLEASE!

    Ok, I stripped out the passage that seems to build the buttons:
    Code:
    /*
     * The HTML form submit button wrapper function
     * Outputs a "submit" button in the selected language
     */
      function zen_image_submit($image, $alt = '', $parameters = '', $sec_class = '') {
        global $template, $current_page_base, $zco_notifier;
        if (strtolower(IMAGE_USE_CSS_BUTTONS) == 'yes' && strlen($alt)<30) return zenCssButton($image, $alt, 'submit', $sec_class, $parameters);
        $zco_notifier->notify('PAGE_OUTPUT_IMAGE_SUBMIT');
    
        $image_submit = '<input type="image" src="' . zen_output_string($template->get_template_dir($image, DIR_WS_TEMPLATE, $current_page_base, 'buttons/' . $_SESSION['language'] . '/') . $image) . '" alt="' . zen_output_string($alt) . '"';
    
        if (zen_not_null($alt)) $image_submit .= ' title=" ' . zen_output_string($alt) . ' "';
    
        if (zen_not_null($parameters)) $image_submit .= ' ' . $parameters;
    
        $image_submit .= ' />';
    
        return $image_submit;
      }
    
    /*
     * Output a function button in the selected language
     */
      function zen_image_button($image, $alt = '', $parameters = '', $sec_class = '') {
        global $template, $current_page_base, $zco_notifier;
    
        // inject rollover class if one is defined. NOTE: This could end up with 2 "class" elements if $parameters contains "class" already.
        if (defined('IMAGE_ROLLOVER_CLASS') && IMAGE_ROLLOVER_CLASS != '') {
          $parameters .= (zen_not_null($parameters) ? ' ' : '') . 'class="rollover"';
        }
    
        $zco_notifier->notify('PAGE_OUTPUT_IMAGE_BUTTON');
        if (strtolower(IMAGE_USE_CSS_BUTTONS) == 'yes') return zenCssButton($image, $alt, 'button', $sec_class, $parameters);
        return zen_image($template->get_template_dir($image, DIR_WS_TEMPLATE, $current_page_base, 'buttons/' . $_SESSION['language'] . '/') . $image, $alt, '', '', $parameters);
      }
    
    
    /**
     * generate CSS buttons in the current language
     * concept from contributions by Seb Rouleau and paulm, subsequently adapted to Zen Cart
     * note: any hard-coded buttons will not be able to use this function
    **/
      function zenCssButton($image = '', $text, $type, $sec_class = '', $parameters = '') {
       global $css_button_text, $css_button_opts, $template, $current_page_base, $language;
    
       $button_name = basename($image, '.gif');
    
        // if no secondary class is set use the image name for the sec_class
        if (empty($sec_class)) $sec_class = $button_name;
        if(!empty($sec_class)) $sec_class = ' ' . $sec_class;
        if(!empty($parameters))$parameters = ' ' . $parameters;
        $mouse_out_class  = 'cssButton ' . (($type == 'submit') ? 'submit_button button ' : 'normal_button button ') . $sec_class;
        $mouse_over_class = 'cssButtonHover ' . (($type == 'button') ? 'normal_button button ' : '') . $sec_class . $sec_class . 'Hover';
        // javascript to set different classes on mouseover and mouseout: enables hover effect on the buttons
        // (pure css hovers on non link elements do work work in every browser)
        $css_button_js =  'onmouseover="this.className=\''. $mouse_over_class . '\'" onmouseout="this.className=\'' . $mouse_out_class . '\'"';
    
        if (CSS_BUTTON_POPUPS_IS_ARRAY == 'true') {
          $popuptext = (!empty($css_button_text[$button_name])) ? $css_button_text[$button_name] : ($button_name . CSSBUTTONS_CATALOG_POPUPS_SHOW_BUTTON_NAMES_TEXT);
          $tooltip = ' title="' . $popuptext . '"';
        } else {
          $tooltip = '';
        }
        $css_button = '';
    
        if ($type == 'submit'){
          // form input button
          if ($parameters != '') {
            // If the input parameters include a "name" attribute, need to emulate an <input type="image" /> return value by adding a _x to the name parameter (creds to paulm)
            if (preg_match('/name="([a-zA-Z0-9\-_]+)"/', $parameters, $matches)) {
              $parameters = str_replace('name="' . $matches[1], 'name="' . $matches[1] . '_x', $parameters);
            }
            // If the input parameters include a "value" attribute, remove it since that attribute will be set to the input text string.
            if (preg_match('/(value="[a-zA-Z0=9\-_]+")/', $parameters, $matches)) {
              $parameters = str_replace($matches[1], '', $parameters);
            }
          }
    
          $css_button = '<input class="' . $mouse_out_class . '" ' . $css_button_js . ' type="submit" value="' . $text . '"' . $tooltip . $parameters . ' />';
        }
    
        if ($type=='button'){
          // link button
          $css_button = '<span class="' . $mouse_out_class . '" ' . $css_button_js . $tooltip . $parameters . '>&nbsp;' . $text . '&nbsp;</span>';
        }
        return $css_button;
      }

  4. #14
    Join Date
    Dec 2007
    Location
    Acton, California
    Posts
    606
    Plugin Contributions
    6

    Default Re: Trying to us html in a define... HELP PLEASE!

    Quote Originally Posted by Feznizzle View Post
    I added this as my defined HEADER_SEARCH_BUTTON in includes/languages/english/MY_TEMPLATE/header.php:
    <i class="fa fa-search" aria-hidden="true"></i>&nbsp;Search
    To go back to your question.. CSS button relies on the ALT define not the button image define.. If for some reason like the CSS failed or you needed to switch back, then the button image is used. I found for buttons within forms, I had to use the font number and for links the html tags and class.
    Code:
    define('BUTTON_SEARCH_ALT', '&#xf00e; Search');
    Code:
    define('BUTTON_CREATE_ACCOUNT_ALT', '<i class="fa fa-user-plus"></i>  Sign Up');
    I also had to edit html_output.php to kill the js switch in forms..
    PHP Code:
    $css_button_js .= '';   // 'onmouseover="this.className=\''. $mouse_over_class . '\'" onmouseout="this.className=\'' . $mouse_out_class . '\'"'; 
    But that could be just the way I have CSS buttons set-up.. I don't like the standard box look..
    Dave
    Working on a new project... MySite..

  5. #15
    Join Date
    Jul 2012
    Posts
    11,635
    Plugin Contributions
    13

    Default Re: Trying to us html in a define... HELP PLEASE!

    Yeah, so since you're using CSS buttons, the call to zen_image_submit basically is converting your " to &quot;. Mostly this is because of the overall construct of the html and that are trying to incorporate a quote within other quoted content.

    The content that you wish to be added should at least in this case be directly added into tpl_search_header.php it appears:

    Code:
    $content .= zen_draw_input_field('keyword', '', 'size="6" maxlength="30" style="width: 100px" placeholder="' . HEADER_SEARCH_DEFAULT_TEXT . '" onfocus="if (this.value == \'' . HEADER_SEARCH_DEFAULT_TEXT . '\') this.value = \'\';" onblur="if (this.value == \'\') this.value = \'' . HEADER_SEARCH_DEFAULT_TEXT . '\';"') . '&nbsp;' . '<i class="fa fa-search" aria-hidden="true"></i>&nbsp;' . zen_image_submit (BUTTON_IMAGE_SEARCH,HEADER_SEARCH_BUTTON);
    And your HEADER_SEARCH_BUTTON text would be Search. The difference here though is that you were trying to add the image to the alternate text which would mean that the image would only appear when hovering over the submit image rather than being displayed with the submit image. Not sure which you were going for, but that's what modifying the HEADER_SEARCH_BUTTON text to include the font awesome tag was doing.

    The above may/may not work as desired. May need to surround in a span or some other html tag to then be able to manipulate it, but it seems along the lines of what you are seeking. I also seem to remember some sort of post a long while back about making such changes, but couldn't for the life of me tell you where, who, etc... I just know that where/how it is being attempted is incorrect. :)
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...
    Upgraded to Zen Cart V1.5.3 from V1.5.1 from V1.5.0 from V1.3.9h

  6. #16
    Join Date
    Jul 2012
    Posts
    11,635
    Plugin Contributions
    13

    Default Re: Trying to us html in a define... HELP PLEASE!

    Quote Originally Posted by Feznizzle View Post
    Hey MC, I think I found the file where the buttons are being assembled!

    Here is /includes/functions/html_output.php (look for IMAGE_USE_CSS_BUTTONS):
    Code:
    Too long, won't let me post!
    If you don't happen to have a copy of zc155e I could post the file.
    This would have been too deep in the code in some extent to incorporate a detail such as if this button is being used. Davewest's suggestion looks to be the route to go with the usage of the defined variable being the controlling factor. As far as the unicode for the search button, it appears to be: f002

    To be entered as: &#xf002
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...
    Upgraded to Zen Cart V1.5.3 from V1.5.1 from V1.5.0 from V1.3.9h

  7. #17
    Join Date
    Apr 2010
    Posts
    884
    Plugin Contributions
    0

    Default Re: Trying to us html in a define... HELP PLEASE!

    Ok, guess I have no choice but to use the unicode call. Unfortunately, that throws a validation warning:
    https://validator.w3.org/nu/?doc=htt...medical.biz%2F

    Not a big deal, I suppose, but zc155 has the ability to do this correctly built in. Take a peak at this product page, you will see
    https://002mc.justmedical.biz/Produc...-Test-1-Images

    You will see the search symbol appears in three places.

    On the search button itself (the black symbol), I did that by first defining...
    define('HEADER_SEARCH_BUTTON', '&#xf002; &nbsp;Search');

    ...and then adding a call to my stylesheet:
    font-family:FontAwesome;

    The other two---one in the product description and the other in white to the left of the search button (created by following MC's instruction in post #16)---were added like this:
    <i class="fa fa-search" aria-hidden="true"></i>

    Neither required a font call via css. Instead, font was automagically applied because it is built into zc155.

 

 
Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 7
    Last Post: 23 Apr 2017, 06:39 AM
  2. Define in Help Please. Newbe
    By Moneyshott in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 15 Dec 2011, 12:38 AM
  3. Please Help trying to setup PayPal Pro
    By ellisn in forum PayPal Website Payments Pro support
    Replies: 17
    Last Post: 9 Aug 2008, 12:12 PM
  4. Page Define Help Please
    By caradelrae in forum Basic Configuration
    Replies: 1
    Last Post: 30 May 2006, 06:26 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