Results 1 to 3 of 3

Hybrid View

  1. #1
    Join Date
    Jan 2007
    Posts
    375
    Plugin Contributions
    3

    red flag How to add php coding? to $content .=

    Hi all,

    I am not programmer, but have knowledge on html and css.

    Now I need change my shop Layout and need ADD some PHP coding to the /includes/templates/template_default/sideboxes/tpl_search.php

    I open the tpl_search.php and see this (Just Example there)

    $content .= "<div>Test</div>";

    It is easy for me to understand, since just a simply html coding..
    ================

    Now I have those of coding that need to add to the $content .=

    But the problems is, they are php coding, how do it add this?

    Here are the coding....

    Code:
    <div class="cart">
                    <!-- ========== SHOPPING CART ========== -->
                        <?php 
                            if ($_SESSION['cart']->count_contents() == 0) {
                                $cart_text = '<a href="' . zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL') . '">' . $_SESSION['cart']->count_contents() . ' items</a>';
                            } elseif ($_SESSION['cart']->count_contents() == 1) {
                                $cart_text = '<a href="' . zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL') . '">' . $_SESSION['cart']->count_contents() . ' item</a>';
                            } else {
                                $cart_text = '<a href="' . zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL') . '">' . $_SESSION['cart']->count_contents() . ' items</a>';
                            }
                        ?>
                        <?php echo $cart_text ?> 
                    <!-- =================================== -->
                </div>

    Thank you very much of your time and help.

  2. #2
    Join Date
    Jun 2008
    Location
    Washington, DC
    Posts
    789
    Plugin Contributions
    7

    Default Re: How to add php coding to $content .=

    Short answer you can't.

    From your example you could load the $cart_text value.
    Run the SHOPPING CART php if statments before your $content is called and do not echo $cart_text at the end of the cart if statements.
    Now place $cart_text
    $content .= "<div>". $cart_text ."</div>";

    Skip
    • 446F63746F722057686F •

  3. #3
    Join Date
    Jan 2007
    Posts
    375
    Plugin Contributions
    3

    Default Re: How to add php coding? to $content .=

    Thank you very much, your way work for me whatever I place the code anywhere.


 

 

Similar Threads

  1. How to Add Content Below category listings?
    By CheapStairParts in forum Templates, Stylesheets, Page Layout
    Replies: 9
    Last Post: 31 Oct 2011, 11:43 AM
  2. How to add content under add to cart?
    By vazvi in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 3 Feb 2011, 12:09 PM
  3. how to add php coding to the 'blank sidebox' addon?
    By tyankee in forum Basic Configuration
    Replies: 2
    Last Post: 21 Mar 2010, 02:55 AM
  4. How to include define_page_2.php content in header for easy editing
    By vandiermen in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 30 May 2009, 07:56 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