12 Replies Latest reply on Mar 1, 2013 2:32 AM by sudarshan.t

    Please help tpl files

    robbiedp8250

      Hi guy

      please can some help me with editing tpl files, i have a test site at http://cybid.host56.com/

      my problem is all the pages are set at 80% of the screen but one page is 100% and i cant find code to change css or php

      the page at fault is http://cybid.host56.com/categories.php?category=Antiques-and-Art&parent_id=215

      it seem to be the sub category page

      please guy help i been on this for 3 days it starting to were me out

      thank you

      robbie

        • 1. Re: Please help tpl files
          robbiedp8250 Level 1

          sorry forgot to mention if you need to see files please email me for ftp login user name and password

          [Email removed by Moderator]

           

          Message was edited by: Sudarshan Thiagarajan

          • 2. Re: Please help tpl files
            sudarshan.t Level 6

            Looks like the CSS is taken from inline on the page. Check your categories.php page to see if you find the CSS below:

             

            .main_table { width:97%; margin-left:20px; margin-right:20px}

            Change that to:

             

            .main_table { width:930px; margin:0 auto;}

            If you don't find any styles in the php file, we may probably need to look into your server-side files. But, that's a last resort - dont reveal your FTP username/ password anywhere please!

             

            PS: i'm removing your e-mail ID from the previous reply you've made for your own security.

             

            -ST

            • 3. Re: Please help tpl files
              robbiedp8250 Level 1

              Thank you for your fast reply and your help

               

              Sorry for m mistake and remoing my email

               

              Can not find         main_table{width:930px;margin:0auto;}

               

              This is the content in categories.php

               

              <?php

               

              session_start();

               

               

              define ('IN_SITE', 1);

               

               

              include_once ('includes/global.php');

               

               

              include_once ('global_header.php');

               

               

              (array) $query = null;

              $parent_id = intval($_REQUEST['parent_id']);

              $advanced_search = ($_REQUEST['advanced_search'] == '') ? 1 : intval($_REQUEST['advanced_search']);

              $template->set('parent_id', $parent_id);

               

              define('IS_CATEGORIES', 1);

               

              //$template->set('db', $db);

               

               

              (string) $subcategories_content = null;

               

               

              $main_category_id = $db->main_category($parent_id);

              $category_details = $db->get_sql_row("SELECT image_path, minimum_age FROM " . DB_PREFIX . "categories WHERE category_id='" . $main_category_id . "'");

              $category_logo = $category_details['image_path'];

               

               

              $category_logo = (!empty($category_logo)) ? '<img src="' . $category_logo . '" border="0">' : '';

              $template->set('category_logo', $category_logo);

               

               

              $categories_header_menu = category_navigator($parent_id, true, true, 'categories.php');

              $template->set('categories_header_menu', $categories_header_menu);

               

               

              if ($_REQUEST['option'] == 'agree_adult')

              {

                        $session->set('adult_category', 1);

              }

               

               

              if ($category_details['minimum_age'] > 0 && !$session->value('adult_category'))

              {

                        $template->set('minimum_age', $category_details['minimum_age']);

                        $template_output .= $template->process('adult_category_warning.tpl.php');

              }

              else

              {

                        $is_subcategories = $db->count_rows('categories', "WHERE parent_id='" . $parent_id . "'");

                        $template->set('is_subcategories', $is_subcategories);

               

                        $sql_select_categories = $db->query("SELECT category_id, items_counter FROM " . DB_PREFIX . "categories WHERE

                                  parent_id='" . $parent_id . "' AND user_id=0 ORDER BY order_id ASC, name ASC");

               

                        while ($cat_details = $db->fetch_array($sql_select_categories))

                        {

                                  $background = ($counter++%2) ? 'c1' : 'c2';

               

                                  $subcategories_content .= '<tr class=" . $background . "> '.

                                            '          <td width="100%"> &raquo; <a href="categories.php?parent_id=' . $cat_details['category_id'] . '">' . $category_lang[$cat_details['category_id']] . '</a> '.

                                            (($setts['enable_cat_counters']) ? (($cat_details['items_counter']) ? '(<strong>' . $cat_details['items_counter'] . '</strong>)' : '') : '') . '</td> '.

                                            '</tr> ';

                        }

               

                        $template->set('subcategories_content', $subcategories_content);

               

                        if ($parent_id)

                        {

                                  (array) $src_cats = null;

                                  (string) $category_name = null;

                                  reset($categories_array);

               

                                  foreach ($categories_array as $key => $value)

                                  {

                                            if ($parent_id == $key)

                                            {

               

                                                      list($category_name, $tmp_user_id) = $value;

                                            }

                                  }

               

                                  reset($categories_array);

               

                                  while (list($cat_array_id, $cat_array_details) = each($categories_array))

                                  {

                                            list($cat_array_name, $cat_user_id) = $cat_array_details;

               

                                            $categories_match = strpos($cat_array_name, $category_name);

                                            if (trim($categories_match) == "0")

                                            {

                                                      $src_cats[] = $cat_array_id;

                                            }

               

                                            $all_subcategories = $db->implode_array($src_cats, ', ');

                                  }

               

                                  $query[] = "(a.category_id IN (" . $all_subcategories . ") OR a.addl_category_id IN (" . $all_subcategories . "))";

                        }

               

                        $item_details = $db->rem_special_chars_array($_REQUEST);

               

                        if ($_REQUEST['buyout_price'] == 0)

                        {

                                  $query[] = "a.buyout_price>0";

                        }

                        if ($_REQUEST['reserve_price'] == 1)

                        {

                                  $query[] = "a.reserve_price>0";

                        }

                        if ($_REQUEST['quantity_standard'] == 1)

                        {

                                  $query[] = "a.quantity=1";

                        }

                        if ($_REQUEST['quantity'] == 1)

                        {

                                  $query[] = "a.quantity>1";

                        }

                        if ($_REQUEST['enable_swap'] == 1)

                        {

                                  $query[] = "a.enable_swap=1";

                        }

                        if ($_REQUEST['direct_payment_only'] == 1)

                        {

                                  $query[] = "a.direct_payment!=''";

                        }

                        if ($_REQUEST['regular_payment_only'] == 1)

                        {

                                  $query[] = "a.payment_methods!=''";

                        }

                        if ($_REQUEST['photos_only'] == 1)

                        {

                                  $query[] = "IF ((SELECT count(*) AS nb_rows FROM " . DB_PREFIX . "auction_media am WHERE am.auction_id=a.auction_id AND

                                            am.media_type=1 AND am.upload_in_progress=0)>0, 1, 0)=1";

                        }

                        $addl_where_query = $db->implode_array($query, ' AND ');

                        $addl_where_query = (!empty($addl_where_query)) ? ' AND ' . $addl_where_query : '';## MyPHPAuction 2009 search in category procedure

               

                        $option = 'category_search';

                        $template->set('option', $option);

                        $template->set('advanced_search', $advanced_search);

               

                        if (!empty($_REQUEST['keywords_cat_search']))

                        {

                                  $keywords_cat_search = optimize_search_string($item_details['keywords_cat_search']);

               

                                  if ($_REQUEST['search_description'] == 1)

                                  {

                                            $addl_where_query .= " AND MATCH (a.name, a.description) AGAINST ('+" . $keywords_cat_search . "' IN BOOLEAN MODE)";

                                  }

                                  else

                                  {

                                            $addl_where_query .= " AND MATCH (a.name) AGAINST ('+" . $keywords_cat_search . "' IN BOOLEAN MODE)";

                                  }

                                  /**

                                             * or the old and SLOW search using LIKE - disabled by default, just added the line in case

                                             * anyone might want to use this instead

                                             */## MyPHPAuction 2009 $addl_store_query = " AND (a.name LIKE '%" . $item_details['keywords_cat_search'] . "%' OR a.description LIKE '%" . $item_details['keywords_cat_search'] . "%')";

                        }

                        $template->set('item_details', $item_details);

               

                        $cats_src_drop_down = '<select name="parent_id" id="parent_id" class="contentfont"> '.

               

                        (array) $src_categories = null;

               

                        $src_categories[] = array('category_id' => $parent_id, 'name' => $category_lang[$parent_id]);

               

                        if ($parent_id > 0 && $parent_id != $main_category_id)

                        {

                                  $cat_id = $parent_id;

               

                                  while ($cat_id)

                                  {

                                            $cat_id = $db->get_sql_field("SELECT parent_id FROM " . DB_PREFIX . "categories WHERE category_id='" . $cat_id . "'", 'parent_id');

                                            if ($cat_id)

                                            {

                                                      $src_categories[] = array('category_id' => $cat_id, 'name' => ' - ' . $category_lang[$cat_id]);

                                            }

                                  }

               

                                  $src_categories[] = array('category_id' => 0, 'name' => '----------------');

               

               

                                  $sql_select_src_subcats = $db->query("SELECT category_id FROM " . DB_PREFIX . "categories WHERE

                                            parent_id=0 AND hidden=0 AND user_id=0 ORDER BY order_id ASC, name ASC");

               

                                  while ($row_cats = $db->fetch_array($sql_select_src_subcats))

                                  {

                                            $src_categories[] = array('category_id' => $row_cats['category_id'], 'name' => $category_lang[$row_cats['category_id']]);

                                  }

                        }

                        else

                        {

                                  $src_categories[] = array('category_id' => 0, 'name' => '----------------');

                                  $sql_select_src_subcats = $db->query("SELECT category_id FROM " . DB_PREFIX . "categories WHERE

                                            parent_id='" . $parent_id . "' ORDER BY order_id ASC, name ASC");

               

                                  while ($row_cats = $db->fetch_array($sql_select_src_subcats))

                                  {

                                            $src_categories[] = array('category_id' => $row_cats['category_id'], 'name' => $category_lang[$row_cats['category_id']]);

                                  }

                        }

               

                        foreach ($src_categories as $key => $value)

                        {

                                  $category_link = process_link('categories', array('category' => $value['name'], 'parent_id' => $value['category_id']));

               

                                  $cats_src_drop_down .= '<option value="' . $value['category_id'] . '" ' . (($value['category_id'] == $parent_id) ? 'selected' : '') . '>'.

                                            $value['name'] . '</option> ';

                        }

                        $cats_src_drop_down .= '</select>';

               

                        $cats_src_adv_search_link = ($advanced_search) ? '<a href="categories.php?parent_id=' . $parent_id . '&keywords_cat_search=' . $item_details['keywords_cat_search'] . '&advanced_search=0">' . MSG_BASIC_SEARCH . '</a>' :

                                  '<a href="categories.php?parent_id=' . $parent_id . '&keywords_cat_search=' . $item_details['keywords_cat_search'] . '&advanced_search=1">' . MSG_ADVANCED_SEARCH . '</a>';

               

                        $template->set('cats_src_adv_search_link', '[ ' . $cats_src_adv_search_link . ' ]');

                        $template->set('cats_src_drop_down', $cats_src_drop_down);

                        $template->set('search_options_title', MSG_SEARCH_IN_THIS_CATEGORY);

                        $categories_search_box = $template->process('search.tpl.php');

                        $template->set('categories_search_box', $categories_search_box);

               

                        /**

                         * featured items, recently listed and ending soon code

                         */

                        if ($layout['catfeat_nb'])

                        {

                                  (array) $item_details = null;

               

                                  $select_condition = "WHERE          a.active=1 AND a.approved=1 AND a.closed=0 AND a.deleted=0

                                            AND a.list_in!='store' AND a.catfeat='1'" . $addl_where_query;

               

                                  $template->set('featured_columns', min((floor($db->count_rows('auctions a', $select_condition)/$layout['catfeat_nb']) + 1), ceil($layout['catfeat_max']/$layout['catfeat_nb'])));

               

                                  $item_details = $db->random_rows('auctions a', 'a.auction_id, a.name, a.start_price, a.max_bid, a.currency, a.end_time', $select_condition, $layout['catfeat_max']);

                                  $template->set('item_details', $item_details);

                        }

               

                        /**

                         * shop in stores code snippet

                         */

               

                        if ($parent_id)

                        {

                                  $sql_select_stores = $db->query("SELECT u.user_id, u.shop_name FROM

                                            " . DB_PREFIX . "users u, " . DB_PREFIX . "auctions a WHERE a.active=1 AND a.approved=1

                                            AND a.closed=0 AND a.deleted=0 AND          a.list_in!='auction'" . $addl_where_query . " AND

                                            a.owner_id=u.user_id AND u.active='1' AND u.shop_active='1' GROUP BY u.user_id");

               

                                  $is_shop_stores = $db->num_rows($sql_select_stores);

                                  $template->set('is_shop_stores', $is_shop_stores);

               

                                  if ($is_shop_stores)

                                  {

                                            (string) $shop_stores_content = null;

                                            while ($store_details = $db->fetch_array($sql_select_stores))

                                            {

                                                      $background = ($counter++%2) ? 'c1' : 'c2';

               

                                                      $shop_stores_content .= '<tr class=" . $background . "> '.

                                                                '          <td width="100%"> &raquo; <a href="shop.php?user_id=' . $store_details['user_id'] . '&parent_id=' . $parent_id . '">' . $store_details['shop_name'] . '</a></td> '.

                                                                '</tr> ';

               

                                            }

               

                                            $template->set('shop_stores_content', $shop_stores_content);

                                  }

                        }

                        $categories_header .= $template->process('categories_header.tpl.php');

                        $categories_footer = $template->process('categories_footer.tpl.php');

               

                        /**

                         * below we have the variables that need to be declared in each separate browse page

                         */

                        $page_url = 'categories';

               

                        $where_query = "WHERE a.active=1 AND a.approved=1 AND a.closed=0 AND a.deleted=0 AND

                                  a.list_in!='store' AND a.creation_in_progress=0" . $addl_where_query;

               

                        $order_field = (in_array($_REQUEST['order_field'], $auction_ordering)) ? $_REQUEST['order_field'] : 'a.end_time';

                        $order_type = (in_array($_REQUEST['order_type'], $order_types)) ? $_REQUEST['order_type'] : 'ASC';

               

                        $additional_vars = '&parent_id=' . $parent_id . '&keywords_cat_search=' . $_REQUEST['keywords_cat_search'] .

                        '&buyout_price=' . $_REQUEST['buyout_price'] . '&reserve_price=' . $_REQUEST['reserve_price'] .

                        '&quantity=' . $_REQUEST['quantity'] . '&enable_swap=' . $_REQUEST['enable_swap'];

               

                        $template->set('categories_header', $categories_header);

                        $template->set('categories_footer', $categories_footer);

               

                        include_once('includes/page_browse_auctions.php');

              }

               

               

              include_once ('global_footer.php');

               

               

              echo $template_output;

               

               

              ?>

               

              Again thank you for looking

               

              Robbie

              • 4. Re: Please help tpl files
                sudarshan.t Level 6

                Can you post contents of includes/global.php and global_header.php?

                • 5. Re: Please help tpl files
                  robbiedp8250 Level 1

                  INCLUDE/GLOBAL.PHP

                   

                   

                  <?php

                   

                  $fileExtension = (file_exists('includes/global.php')) ? '' : '../';

                   

                   

                  include_once ($fileExtension.'includes/config.php');

                   

                   

                   

                   

                  define('INCLUDED', 1);

                   

                   

                  define('DEFAULT_DB_LANGUAGE', 'english');

                   

                   

                  function getmicrotime()

                  {

                     list($usec, $sec) = explode(" ", microtime());

                     return ((float)$usec + (float)$sec);

                  }

                   

                   

                  if(!function_exists('memory_get_usage'))

                  {

                            function memory_get_usage()

                            {

                                      if ( substr(PHP_OS,0,3) == 'WIN')

                                      {

                                                $output = array();

                                                exec( 'tasklist /FI "PID eq ' . getmypid() . '" /FO LIST', $output );

                   

                   

                                                return preg_replace( '/[\D]/', '', $output[5] ) * 1024;

                                      }

                                      else

                                      {

                                                //We now assume the OS is UNIX

                                                $pid = getmypid();

                                                exec("ps -eo%mem,rss,pid | grep $pid", $output);

                                                $output = explode("  ", $output[0]);

                                                //rss is given in 1024 byte units

                                                return $output[1] * 1024;

                                      }

                            }

                  }

                   

                   

                  $time_start = getmicrotime();

                  ##$memory_start = memory_get_usage();

                   

                   

                  include_once ($fileExtension.'language/'.DEFAULT_DB_LANGUAGE.'/db.lang.php');

                   

                   

                  include_once ($fileExtension.'includes/class_database.php');

                   

                   

                  $db = new database;

                   

                   

                  $db->connect($db_host, $db_username, $db_password);

                  $db->select_db($db_name);

                  $db->display_errors = true;

                  include_once ($fileExtension.'includes/class_session.php'); ## global

                  ## create the session class, will contain all session variables.

                  $session = new session;

                   

                   

                  include_once ($fileExtension.'includes/init.php'); ## global

                  $current_version = '6.05';

                   

                   

                  include_once ($fileExtension.'includes/functions_security.php');

                   

                   

                  cleanData();

                   

                   

                  /**

                  * sanitize order_type and order_field variables

                  */

                  $_REQUEST['order_type'] = (in_array($_REQUEST['order_type'], array('ASC', 'DESC'))) ? $_REQUEST['order_type'] : 'DESC';

                   

                   

                   

                   

                  if (!empty($_REQUEST['order_field']))

                  {

                            $order_field_explode = explode(' ', $_REQUEST['order_field']);

                   

                            if (count($order_field_explode) > 1)

                            {

                                      die('Fatal Error: Query Prohibited');

                            }

                  }

                   

                   

                  include_once ($fileExtension.'includes/functions.php'); ## global

                   

                   

                  @include_once ($fileExtension.'includes/functions_integration.php'); ## PPB & PPA Integration

                   

                   

                  ## now do the theme alterations in case of categories and auction_details

                  $is_custom_skin = 0;

                  if (eregi('categories.php', $_SERVER['PHP_SELF']))

                  {

                            $category_id = $db->main_category(intval($_GET['parent_id']));

                   

                   

                            $is_custom_skin = 1;

                  }

                  else if (eregi('auction_details.php', $_SERVER['PHP_SELF']))

                  {

                            $category_id = $db->get_sql_field("SELECT category_id FROM " . DB_PREFIX . "auctions WHERE

                                      auction_id='" . intval($_GET['auction_id']) . "'", 'category_id');

                   

                            $category_id = $db->main_category($category_id);

                   

                            $is_custom_skin = 1;

                  }

                   

                   

                  if ($is_custom_skin)

                  {

                            $custom_skin = $db->get_sql_field("SELECT custom_skin FROM " . DB_PREFIX . "categories WHERE

                                      category_id='" . $category_id . "'", 'custom_skin');

                   

                            if (!empty($custom_skin))

                            {

                                      $setts['default_theme'] = $custom_skin;

                                      define ('DEFAULT_THEME', $custom_skin);

                            }

                  }

                   

                   

                  unlink_pin();

                   

                   

                  include_once ($fileExtension.'includes/class_template.php');

                   

                   

                  ## initialize the template for the output that will be generated

                  $template = new template('templates/');

                   

                   

                  $template->set('setts', $setts);

                  $template->set('layout', $layout);

                  $template->set('current_version', $current_version);

                  $template->set('is_seller', $session->value('is_seller'));

                   

                   

                  (string) $template_output = NULL;

                   

                   

                  if ($setts['maintenance_mode'] && $session->value('adminarea')!='Active' && IN_ADMIN != 1)

                  {

                            $template_output = $template->process('maintenance_splash_page.tpl.php');

                   

                   

                            echo $template_output;

                            die();

                  }

                   

                   

                  include_once ($fileExtension.'includes/class_voucher.php');

                  include_once ($fileExtension.'includes/class_fees_main.php');

                  include_once ($fileExtension.'includes/class_tax.php');

                   

                   

                  $fees = new fees_main();

                  $fees->setts = &$setts;

                  $template->set('fees', $fees);

                   

                   

                  $template->set('db', $db);

                   

                   

                  include_once ($fileExtension.'includes/class_banner.php');

                   

                   

                  ## classes used in most files will be initialized here.

                   

                   

                  include_once ($fileExtension.'includes/functions_date.php');

                   

                   

                  ## declare all the pages that can contain custom fields

                  $custom_fields_pages = array ('register', 'reputation_sale', 'reputation_purchase', 'auction', 'wanted_ad');

                   

                   

                  ## custom section pages

                  $custom_section_pages = array ('help', 'news', 'faq', 'custom_page', 'announcements');

                  $custom_section_pages_ordering = array('help', 'faq', 'custom_page');

                   

                   

                  $custom_pages = array('about_us', 'contact_us', 'terms', 'privacy');

                   

                   

                  ## declare all tables that are linkable to custom fields

                  $linkable_tables = array('countries');

                   

                   

                  ## load the cron if it is run from the site.

                  if ($setts['cron_job_type'] == 2 && IN_ADMIN != 1)

                  {

                            $manual_cron = true;

                            include_once ($fileExtension . 'cron_jobs/main_cron.php');

                  }

                   

                   

                  $auction_ordering = array('a.name', 'a.start_price', 'a.max_bid', 'a.nb_bids', 'a.end_time');

                  $order_types = array('DESC', 'ASC');

                  ## suspend user accounts that are over the debit limit. -> placeholder

                   

                   

                  ### IP Logging addon, created by Kevin

                   

                   

                  if ($session->value('user_id') > 0)

                  {

                            $set = 0;

                   

                            $db->query("CREATE TABLE IF NOT EXISTS " . DB_PREFIX . "iphistory (

                                      `memberid` INT NOT NULL,

                                      `time1` INT NOT NULL,

                                      `time2` INT NOT NULL,

                                      `ip` VARCHAR(20) NOT NULL

                            )");

                   

                            $sql_select_iphistory = $db->query("SELECT time1, time2, ip FROM " . DB_PREFIX . "iphistory WHERE

                                      memberid='" . $session->value('user_id') . "' ORDER by time1 DESC LIMIT 1");

                   

                            if ($db->num_rows($sql_select_iphistory) > 0)

                            {

                                      if ($ip_details = $db->fetch_array($sql_select_iphistory))

                                      {

                                                if ($ip_details['ip'] == $_SERVER['REMOTE_ADDR'])

                                                {

                                                          $db->query("UPDATE " . DB_PREFIX . "iphistory SET time2='" . CURRENT_TIME . "' WHERE

                                                                    time1='" . $ip_details['time1'] . "' AND ip='" . $ip_details['ip'] . "'");

                   

                   

                                                          $set = 1;

                                                }

                                      }

                            }

                   

                            if (!$set)

                            {

                                      $db->query("INSERT INTO " . DB_PREFIX . "iphistory VALUES

                                                ('" . $session->value('user_id') . "', '" . CURRENT_TIME . "', '0', '" . $_SERVER['REMOTE_ADDR'] . "')");

                            }

                  }

                   

                   

                  include_once ($fileExtension.'includes/class_shop.php');

                  include_once ($fileExtension.'includes/functions_addons.php');

                   

                   

                  ?>

                   

                   

                  GLOBAL_HEADER.PHP

                   

                  no file

                  • 6. Re: Please help tpl files
                    sudarshan.t Level 6

                    I'm PM'ing you.

                    • 7. Re: Please help tpl files
                      sudarshan.t Level 6

                      You should have received a PM in your Private Message folder on the forums. Please respond to that.

                      • 8. Re: Please help tpl files
                        robbiedp8250 Level 1

                        i have pm you have you not recieved it

                        • 9. Re: Please help tpl files
                          robbiedp8250 Level 1

                          Sorry did you recieve my pm

                          • 10. Re: Please help tpl files
                            sudarshan.t Level 6

                            Fixed it.

                             

                            themes/yellow/templates/header.tpl.php

                            Lines 22, 24 & 25 - was causing the browser to add .main_table override CSS at runtime. Changed it to the desired value. Should work just fine now. Please check.

                             

                            -ST

                            • 11. Re: Please help tpl files
                              robbiedp8250 Level 1

                              Thank you it works

                              i cannot believe you did that in such short time

                              again thank you

                              rob

                              • 12. Re: Please help tpl files
                                sudarshan.t Level 6

                                You're welcome, Rob.

                                 

                                Do post back if you have any more questions. Happy to help