Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2008
    Posts
    170
    Plugin Contributions
    0

    Default PHP Question: Inserting code to refer to another .php file

    I'm currently redoing the layout for a ZC store and, not being the biggest PHP expert, I was wondering if someone could answer what I hope is a simple question:

    I have a div and I want to place some PHP code that displays what is normally in the Featured Products area you normally get on the default. But I just want it to appear in the div. So how do I write that code to insert that area? I know it should make a call to tpl_modules_featured_products.php but that's about it.

  2. #2
    Join Date
    Aug 2006
    Location
    UK
    Posts
    449
    Plugin Contributions
    0

    Default Re: PHP Question: Inserting code to refer to another .php file

    why not duplicate the code from the template - tpl_modules_featured_products to wherever you need it and change the div from;
    <div class="centerBoxWrapper" id="featuredProducts">

    to whatever you need... I suggest using a class definition to allow later styling with CSS...
    ~Steve~

  3. #3
    Join Date
    Jun 2008
    Posts
    170
    Plugin Contributions
    0

    Default Re: PHP Question: Inserting code to refer to another .php file

    How about:
    <?php include("../templates/tpl_modules_featured_products.php"); ?>

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

    Default Re: PHP Question: Inserting code to refer to another .php file

    Just my two cents here.

    Both solutions are great. The only decision point would be if you want to "massage" this page differently than the featured products.

    s t e v e has put forth a solution that would allow you to make your own css settings for this page.

    datatv's solution would automatically change as you change the settings for the featured products page.

    just a little sumpin' sumpin' for the lurkers.
    A little help with colors.
    myZenCartHost.com - Zen Cart Certified, PCI Compatible Hosting by JEANDRET
    Free SSL & Domain with semi-annual and longer hosting. Updating 1.5.2 and Up.

 

 

Similar Threads

  1. Inserting Code into tpl_header.php
    By drymetal in forum Templates, Stylesheets, Page Layout
    Replies: 37
    Last Post: 21 Jan 2010, 10:07 AM
  2. Passing a hidden customer_id to another php file
    By Somerschool in forum General Questions
    Replies: 7
    Last Post: 12 May 2009, 07:35 PM
  3. php code question...placement tpl header file
    By bwhitmire in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 22 Sep 2008, 03:56 PM
  4. PhP question about a line of code in includes/classes/order.php
    By dbrewster in forum Managing Customers and Orders
    Replies: 12
    Last Post: 1 Feb 2007, 03:30 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