Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2006
    Location
    Kihikihi, New Zealand
    Posts
    230
    Plugin Contributions
    3

    help question Difficulty displaying image in new sidebox module

    Hi all,
    I am trying to build a template sidebox that can be used to add several social style websites and personal blogs, that can be styled to suit different image sizes and layouts inside the sidebox.

    I need to display an image that links to the site:
    HTML Code:
    <a href="social_site_url/social_site_ID" target="_blank" title=""><img src="social_site.jpg" width="" height="" alt="" id="" /></a>
    The image is located in templates/MY_TEMPLATE/images
    My coding of both the <a href=""> and the <img src=""> are not correct.
    Where did I go wrong?

    tpl_social_sidebox.php:
    Code:
    <?php
      $content = '';
      $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent" id="socialSidebox">';
      $content .= ?>'<a href="<?php FACEBOOK_URL . YOUR_FACEBOOK_NAME ?>"  target="_blank" title="<?php FACEBOOK_TITLE ?>"><img src="<?php ($template->get_template_dir(DIR_WS_TEMPLATE, $current_page_base,'images'), FACEBOOK_IMAGE_NAME ?>"  width='<?php FACEBOOK_IMAGE_WIDTH ?>' height='<?php  FACEBOOK_IMAGE_HEIGHT ?>' alt='<?php FACEBOOK_ALT ?>' id='socialImages')" /></a>';
    <?php
      $content .= '</div>';
    ?>
    Any help greatly appreciated,

    Goshawk
    Time is but an illusion, there is only "now"!

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

    Default Re: Difficulty displaying image in new sidebox module

    You want to use "echo" to output the constants and data to HTML.
    <?php FACEBOOK_URL . YOUR_FACEBOOK_NAME ?>
    should be
    <?php echo FACEBOOK_URL . YOUR_FACEBOOK_NAME ?>

  3. #3
    Join Date
    Aug 2006
    Location
    Kihikihi, New Zealand
    Posts
    230
    Plugin Contributions
    3

    Default Re: Difficulty displaying image in new sidebox module

    Thanks for your reply, but I still have a syntax error.

    Code:
      $content .= '?><a href='<?php echo FACEBOOK_URL . YOUR_FACEBOOK_NAME ?>' target="_blank" title='<?php echo FACEBOOK_TITLE ?>'><img <?php ($template->get_template_dir(DIR_WS_TEMPLATE, $current_page_base,'images'), ?> src='<?php echo FACEBOOK_IMAGE_NAME ?>'  width='<?php echo FACEBOOK_IMAGE_WIDTH ?>' height='<?php echo FACEBOOK_IMAGE_HEIGHT ?>' alt='<?php echo FACEBOOK_ALT ?>' id="socialImages" />" /></a><?php';
    Time is but an illusion, there is only "now"!

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

    Default Re: Difficulty displaying image in new sidebox module

    Yes, you do. You have used single quotes for both PHP code and some HTML code, and this is confusing things. I also missed the fact that you start with PHP in $content .= , and so need to change the way you output PHP data inside the link code.
    PHP Code:
    $content .= '<a href="' FACEBOOK_URL YOUR_FACEBOOK_NAME '" target="_blank" title="' FACEBOOK_TITLE '"><img src="' .  ($template->get_template_dir(DIR_WS_TEMPLATE$current_page_base,'images'), FACEBOOK_IMAGE_NAME '"  width="' FACEBOOK_IMAGE_WIDTH '" height="' FACEBOOK_IMAGE_HEIGHT '" alt="' FACEBOOK_ALT '" id="socialImages" /></a>'
    Not guaranteeing I got every bit here...
    Last edited by gjh42; 10 Sep 2013 at 01:07 AM.

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

    Default Re: Difficulty displaying image in new sidebox module

    There are two basic ways to create HTML output in a PHP file, and you can't mix them without problems.

    You can use complete HTML statements outside of <?php ?> tags, with variables inserted using <?php echo $whatever ?>. This will output each line of HTML to the browser immediately as it occurs in the file.

    Or you can accumulate the HTML content in a variable like $content, and output the entire thing later using <?php echo $content;?>

 

 

Similar Threads

  1. Difficulty Installing the Dual-Pricing-2.1.5 Module
    By buick66 in forum All Other Contributions/Addons
    Replies: 7
    Last Post: 29 Apr 2015, 09:24 PM
  2. difficulty adding a new template
    By billcurley in forum Templates, Stylesheets, Page Layout
    Replies: 16
    Last Post: 10 Jun 2012, 02:10 PM
  3. New Module for displaying Top Brands-Manufactures?
    By dharam1987 in forum All Other Contributions/Addons
    Replies: 2
    Last Post: 1 Oct 2011, 09:13 AM
  4. difficulty installing dropship module
    By dallison in forum Addon Shipping Modules
    Replies: 2
    Last Post: 30 Aug 2010, 11:59 PM
  5. Sidebox Image Not Displaying !!!
    By wifidoc in forum Basic Configuration
    Replies: 2
    Last Post: 9 Feb 2008, 08:45 PM

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