How to add this code to this code?

Looking at mainpage.tpl.php I see that it is different from auction_details.tpl.php so I need to know how mainpage.tpl.php is called.

This is how auction_details.tpl.php is called from auction_details.php:
$template_output .= $template->process(‘auction_details.tpl.php’);

So which program you use to call mainpage.tpl.php? I also need the source code of that program.

Hello tom8, here is the code, hope this will shine light on the situation :slight_smile:

<?
#################################################################
## ultra\	emplates\\mainpage.tpl.php						   ##
##-------------------------------------------------------------##
## Copyright 2012 . All rights reserved.                 	##
##-------------------------------------------------------------##
#################################################################

if ( !defined('INCLUDED') ) { die("Access Denied"); }
?>
<? if ($layout['hpfeat_nb']) { ?>
<?=$featured_auctions_header;?>

<table width="100%" border="0" cellpadding="0" cellspacing="3" >
   <?
	$counter = 0;
	for ($i=0; $i<$featured_columns; $i++) { ?>
   <tr>
      <?
      for ($j=0; $j<$layout['hpfeat_nb']; $j++) {
			$width = 100/$layout['hpfeat_nb'] . '%'; ?>
      <td width="<?=$width;?>" align="center" valign="top"><?
      	if (!empty($item_details[$counter]['name'])) {
      		$main_image = $db->get_sql_field("SELECT media_url FROM " . DB_PREFIX . "auction_media WHERE
      			auction_id='" . $item_details[$counter]['auction_id'] . "' AND media_type=1 AND upload_in_progress=0 ORDER BY media_id ASC LIMIT 0,1", 'media_url');

      		$auction_link = process_link('auction_details', array('name' => $item_details[$counter]['name'], 'auction_id' => $item_details[$counter]['auction_id']));?>
         <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
               <td width="4"><img src="themes/<?=$setts['default_theme'];?>/img/f1.gif" width="4" height="4"></td>
               <td width="100%" background="themes/<?=$setts['default_theme'];?>/img/fb1.gif"><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="1"></td>
               <td width="4"><img src="themes/<?=$setts['default_theme'];?>/img/f2.gif" width="4" height="4"></td>
            </tr>
            <tr>
               <td width="4" background="themes/<?=$setts['default_theme'];?>/img/fb4.gif"><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="1"></td>
               <td width="100%" bgcolor="#f9fafb"><table width="100%" border="0" cellspacing="1" cellpadding="3">
                     <tr height="<?=$layout['hpfeat_width']+12;?>">
                        <td align="center"><a href="<?=$auction_link;?>"><img src="<? echo ((!empty($main_image)) ? 'thumbnail.php?pic=' . $main_image . '&w=' . $layout['hpfeat_width'] . '&sq=Y' : 'themes/' . $setts['default_theme'] . '/img/system/noimg.gif');?>" border="0" alt="<?=$item_details[$counter]['name'];?>"></a></td>
                     </tr>
                     <tr>
                        <td class="c1feat">&raquo; <a href="<?=$auction_link;?>"><?=title_resize($item_details[$counter]['name']);?></a></td>
                     </tr>
                     <tr>
                        <td><b><?=MSG_START_BID;?>:</b> <? echo $feat_fees->display_amount($item_details[$counter]['start_price'], $item_details[$counter]['currency']);?> <br>
                           <b><?=MSG_CURRENT_BID;?>:</b> <? echo $feat_fees->display_amount($item_details[$counter]['max_bid'], $item_details[$counter]['currency']);?> <br>
                           <b><?=MSG_ENDS;?>:</b> <? echo show_date($item_details[$counter]['end_time']); ?> </td>
                     </tr>
                  </table></td>
               <td width="4" background="themes/<?=$setts['default_theme'];?>/img/fb2.gif"><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="1"></td>
            </tr>
            <tr>
               <td width="4"><img src="themes/<?=$setts['default_theme'];?>/img/f4.gif" width="4" height="4"></td>
               <td width="100%" background="themes/<?=$setts['default_theme'];?>/img/fb3.gif"><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="1"></td>
               <td width="4"><img src="themes/<?=$setts['default_theme'];?>/img/f3.gif" width="4" height="4"></td>
            </tr>
         </table>
         <? $counter++;
      	} ?></td>
      <? } ?>
   </tr>
   <? } ?>
</table>
<div><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="10"></div>
<? } ?>
<? if ($layout['r_hpfeat_nb'] && $setts['enable_reverse_auctions']) { ?>
<?=$featured_reverse_auctions_header;?>
<table width="100%" border="0" cellpadding="3" cellspacing="3" >
   <?
	$counter = 0;
	for ($i=0; $i<$featured_ra_columns; $i++) { ?>
   <tr>
      <?
      for ($j=0; $j<$layout['r_hpfeat_nb']; $j++) {
			$width = 100/$layout['r_hpfeat_nb'] . '%'; ?>
      <td width="<?=$width;?>" align="center" valign="top"><?
      	if (!empty($ra_details[$counter]['name'])) {
      		$auction_link = process_link('reverse_details', array('name' => $ra_details[$counter]['name'], 'reverse_id' => $ra_details[$counter]['reverse_id']));?>
         <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
               <td width="4"><img src="themes/<?=$setts['default_theme'];?>/img/f1.gif" width="4" height="4"></td>
               <td width="100%" background="themes/<?=$setts['default_theme'];?>/img/fb1.gif"><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="1"></td>
               <td width="4"><img src="themes/<?=$setts['default_theme'];?>/img/f2.gif" width="4" height="4"></td>
            </tr>
            <tr>
               <td width="4" background="themes/<?=$setts['default_theme'];?>/img/fb4.gif"><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="1"></td>
               <td width="100%" bgcolor="#f9fafb"><table width="100%" border="0" cellspacing="1" cellpadding="3">
                     <tr>
                        <td class="c1feat">&raquo; <a href="<?=$auction_link;?>"><?=title_resize($ra_details[$counter]['name']);?></a></td>
                     </tr>
                     <tr>
                        <td><b><?=MSG_BUDGET;?>:</b> <? echo $feat_fees->budget_output($ra_details[$counter]['budget_id'], null, $ra_details[$counter]['currency']);?>  <br>
                           <b><?=MSG_NR_BIDS;?>:</b> <? echo $ra_details[$counter]['nb_bids'];?> <br>
                           <b><?=MSG_ENDS;?>:</b> <? echo show_date($ra_details[$counter]['end_time']); ?> </td>
                     </tr>
                  </table></td>
               <td width="4" background="themes/<?=$setts['default_theme'];?>/img/fb2.gif"><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="1"></td>
            </tr>
            <tr>
               <td width="4"><img src="themes/<?=$setts['default_theme'];?>/img/f4.gif" width="4" height="4"></td>
               <td width="100%" background="themes/<?=$setts['default_theme'];?>/img/fb3.gif"><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="1"></td>
               <td width="4"><img src="themes/<?=$setts['default_theme'];?>/img/f3.gif" width="4" height="4"></td>
            </tr>
         </table>
         <? $counter++;
      	} ?></td>
      <? } ?>
   </tr>
   <? } ?>
</table>
<div><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="5"></div>
<? } ?>
<div id="TabbedPanels1" class="TabbedPanels">
   <ul class="TabbedPanelsTabGroup">
      <? if ($layout['nb_recent_auct']) { ?>
      <li class="TabbedPanelsTab" tabindex="0"><a href="javascript:void(0);"><div><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="9" border="0"></div><?=MSG_RECENTLY_LISTED_AUCTIONS;?></a></li>
      <? } ?>
		<? if ($layout['nb_ending_auct']) { ?>
      <li class="TabbedPanelsTab" tabindex="0"><a href="javascript:void(0);"><div><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="9" border="0"></div><?=MSG_ENDING_SOON_AUCTIONS;?></a></li>
      <? } ?>
		<? if ($layout['nb_popular_auct'] && $is_popular_items) { ?>
      <li class="TabbedPanelsTab" tabindex="0"><a href="javascript:void(0);"><div><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="9" border="0"></div><?=MSG_MM_POPULAR;?></a></li>
      <? } ?>
		<? if ($setts['enable_wanted_ads'] && $layout['nb_want_ads']) { ?>
      <li class="TabbedPanelsTab" tabindex="0"><a href="javascript:void(0);"><div><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="9" border="0"></div><?=MSG_MM_WANTED_ADS;?></a></li>
      <? } ?>
      <? if ($setts['enable_reverse_auctions'] && $layout['r_recent_nb']) { ?>
		<li class="TabbedPanelsTab" tabindex="0"><a href="javascript:void(0);"><div><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="9" border="0"></div><?=MSG_MM_REVERSE_AUCTIONS;?></a></li>
		<? } ?>
   </ul>
   <div class="TabbedPanelsContentGroup" >
		<? if ($layout['nb_recent_auct']) { ?>
      <div class="TabbedPanelsContent">
         <br>
         <table width="100%" border="0" cellspacing="1" cellpadding="3">
			<?
			$columns = 3;
			$nb_recent = $db->num_rows($sql_select_recent_items);
			for($i = 0; $i < $nb_recent; $i++)
			{
				$item_details = mysql_fetch_array($sql_select_recent_items);
				$main_image = $db->get_sql_field("SELECT media_url FROM " . DB_PREFIX . "auction_media WHERE auction_id='" . $item_details['auction_id'] . "' AND media_type=1 AND upload_in_progress=0 ORDER BY media_id ASC LIMIT 0,1", 'media_url');
				$background = ($item_details['bold']) ? ' bold_item' : '';
				$background .= ($item_details['hl']) ? ' hl_item1' : '';

				if($i % $columns == 0) { ?>
            <tr height="15" valign="top">
				<? } ?>
               <td width="33%"><table width="100%" border="0" cellpadding="3" cellspacing="1" class="border <?	if(CURRENT_TIME - $item_details['start_time'] <= 86400) { echo "today"; } ?>">
                     <tr height="215">
                        <td align="center" class="<?=$background;?>"><a href="<?=process_link('auction_details', array('name' => $item_details['name'], 'auction_id' => $item_details['auction_id']));?>"><img src="<? echo ((!empty($main_image)) ? 'thumbnail.php?pic=' . $main_image . '&w=' . $layout['hpfeat_width'] . '&sq=Y' : 'themes/' . $setts['default_theme'] . '/img/system/noimg.gif');?>" border="0" width="100" alt="<?=title_resize($item_details['name']);?>"></a> <br>
                           <div class="c1feat"><a href="<?=process_link('auction_details', array('name' => $item_details['name'], 'auction_id' => $item_details['auction_id']));?>"><?=title_resize($item_details['name']);?></a></div>
                           <br>
                           <?=GMSG_START_TIME;?>: <?=show_date($item_details['start_time']);?>
                           <br>
                           <?=MSG_START_BID;?>: <?=$fees->display_amount($item_details['start_price'], $item_details['currency']);?>
									<br>
                           <br>
                           <?=item_pics1($item_details);?>
                        </td>
                     </tr>
                  </table></td>
				<? if(($i % $columns) == ($columns - 1) || ($i + 1) == $nb_recent) { ?>
            </tr>
            <? } ?>
            <? } ?>
         </table>
         <div align="right" style="padding: 5px;" class="contentfont"><a href="<?=process_link('auctions_show', array('option' => 'recent'));?>"><?=MSG_VIEW_ALL;?></a></div>
      </div>
		<? } ?>
		<? if ($layout['nb_ending_auct']) { ?>
      <div class="TabbedPanelsContent">
         <br>
         <table width="100%" border="0" cellspacing="1" cellpadding="3">
			<?
		   $columns = 3;
		   $nb_ending = $db->num_rows($sql_select_ending_items);
		
			for($i = 0; $i < $nb_ending; $i++)
			{
				$item_details = mysql_fetch_array($sql_select_ending_items);
				$main_image = $db->get_sql_field("SELECT media_url FROM " . DB_PREFIX . "auction_media WHERE auction_id='" . $item_details['auction_id'] . "' AND media_type=1 AND upload_in_progress=0 ORDER BY media_id ASC LIMIT 0,1", 'media_url');

				$item_details['max_bid'] = ($item_details['max_bid'] > 0) ? $item_details['max_bid'] : $item_details['start_price'];
		
				$background = ($item_details['bold']) ? ' bold_item' : '';
				$background .= ($item_details['hl']) ? ' hl_item1' : '';
				
				if($i % $columns == 0) { ?>
            <tr height="15" valign="top">
            <? } ?>
               <td width="33%"><table width="100%" border="0" cellpadding="3" cellspacing="1" class='border
						<?	if((($item_details['end_time'] - CURRENT_TIME) <= 86400) && $item_details['auction_type'] != 'first_bidder') /* 1day = 86400 sec */ { echo "day"; }?>
						<?	if((($item_details['end_time'] - CURRENT_TIME) <= 3600) && $item_details['auction_type'] != 'first_bidder') /* 1hour = 3600 sec */ { echo "hour"; }?>'>
                     <tr height="215">
                        <td align="center" class="<?=$background;?>"><a href="<?=process_link('auction_details', array('name' => $item_details['name'], 'auction_id' => $item_details['auction_id']));?>"><img src="<? echo ((!empty($main_image)) ? 'thumbnail.php?pic=' . $main_image . '&w=100&sq=Y' : 'themes/' . $setts['default_theme'] . '/img/system/noimg.gif');?>" border="0" width="100" alt="<?=title_resize($item_details['name']);?>"></a> <br>
                           <div class="c1feat"><a href="<?=process_link('auction_details', array('name' => $item_details['name'], 'auction_id' => $item_details['auction_id']));?>"><?=title_resize($item_details['name']);?></a></div>
                           <br>
                           <?=MSG_TIME_LEFT;?>: <?=time_left($item_details['end_time']);?>
                           <br>
                           <?=MSG_CURRENTLY;?>: <?=$fees->display_amount($item_details['max_bid'], $item_details['currency']);?>
                           <br>
                           <br>
                           <?=item_pics1($item_details);?>
                        </td>
                     </tr>
                  </table></td>
            <? if(($i % $columns) == ($columns - 1) || ($i + 1) == $nb_ending) { ?>
            </tr>
            <? } ?>
            <? } ?>
         </table>
         <div align="right" style="padding: 5px;" class="contentfont"><a href="<?=process_link('auctions_show', array('option' => 'ending'));?>"><?=MSG_VIEW_ALL;?></a></div>
      </div>
		<? } ?>
		<? if ($layout['nb_popular_auct'] && $is_popular_items) { ?>
      <div class="TabbedPanelsContent">
         <br>
         <table width="100%" border="0" cellspacing="1" cellpadding="3">
			<?
		   $columns = 3;
		   $nb_popular = $db->num_rows($sql_select_popular_items);
		
			for($i = 0; $i < $nb_popular; $i++)
			{
				$item_details = mysql_fetch_array($sql_select_popular_items);
				$main_image = $db->get_sql_field("SELECT media_url FROM " . DB_PREFIX . "auction_media WHERE auction_id='" . $item_details['auction_id'] . "' AND media_type=1 AND upload_in_progress=0 ORDER BY media_id ASC LIMIT 0,1", 'media_url');
				$background = ($item_details['bold']) ? ' bold_item' : '';
				$background .= ($item_details['hl']) ? ' hl_item1' : '';
				
				if($i % $columns == 0) { ?>
            <tr height="15" valign="top">
            <? } ?>
               <td width="33%"><table width="100%" border="0" cellpadding="3" cellspacing="1" class="border">
                     <tr height="215">
                        <td align="center" class="<?=$background;?>"><a href="<?=process_link('auction_details', array('name' => $item_details['name'], 'auction_id' => $item_details['auction_id']));?>"><img src="<? echo ((!empty($main_image)) ? 'thumbnail.php?pic=' . $main_image . '&w=100&sq=Y' : 'themes/' . $setts['default_theme'] . '/img/system/noimg.gif');?>" border="0" width="100" alt="<?=title_resize($item_details['name']);?>"></a> <br>
                           <div class="c1feat"><a href="<?=process_link('auction_details', array('name' => $item_details['name'], 'auction_id' => $item_details['auction_id']));?>"><?=title_resize($item_details['name']);?></a></div>
                           <br>
                           <?=MSG_MAX_BID;?>: <?=$fees->display_amount($item_details['max_bid'], $item_details['currency']);?>
                           <br>
                           <br>
                           <?=item_pics1($item_details);?>
                        </td>
                     </tr>
                  </table></td>
				<? if(($i % $columns) == ($columns - 1) || ($i + 1) == $nb_popular) { ?>
            </tr>
            <? } ?>
            <? } ?>
         </table>
         <div align="right" style="padding: 5px;" class="contentfont"><a href="<?=process_link('auctions_show', array('option' => 'popular'));?>"><?=MSG_VIEW_ALL;?></a></div>
      </div>
		<? } ?>
		<? if ($setts['enable_wanted_ads'] && $layout['nb_want_ads']) { ?>
      <div class="TabbedPanelsContent"> <br>
         <table width="100%" border="0" cellspacing="1" cellpadding="3">
			<?
		   $columns = 3;
		   $nb_wanted = $db->num_rows($sql_select_recent_wa);
		
			for($i = 0; $i < $nb_wanted; $i++)
			{
				$item_details = mysql_fetch_array($sql_select_recent_wa);
				$main_image = $db->get_sql_field("SELECT media_url FROM " . DB_PREFIX . "auction_media WHERE wanted_ad_id='" . $item_details['wanted_ad_id'] . "' AND media_type=1 AND upload_in_progress=0 ORDER BY media_id ASC LIMIT 0,1", 'media_url');
				
				if($i % $columns == 0) { ?>
            <tr height="15" valign="top">
				<? } ?>
               <td width="33%"><table width="100%" border="0" cellpadding="3" cellspacing="1"  class="border">
                     <tr height="215">
                        <td align="center"><a href="<?=process_link('wanted_details', array('name' => $item_details['name'], 'wanted_ad_id' => $item_details['wanted_ad_id']));?>"><img src="<? echo ((!empty($main_image)) ? 'thumbnail.php?pic=' . $main_image . '&w=100&sq=Y' : 'themes/' . $setts['default_theme'] . '/img/system/noimg.gif');?>" border="0" width="100" alt="<?=title_resize($item_details['name']);?>"></a> <br>
                           <div class="c1feat"><a href="<?=process_link('wanted_details', array('name' => $item_details['name'], 'wanted_ad_id' => $item_details['wanted_ad_id']));?>">
                              <?=title_resize($item_details['name']);?>
                              </a></div>
                           <br>
                           <?=GMSG_START_TIME;?>: <?=show_date($item_details['start_time']);?>
                           <br>
                        </td>
                     </tr>
                  </table></td>
				<? if(($i % $columns) == ($columns - 1) || ($i + 1) == $nb_wanted) { ?>
            </tr>
            <? } ?>
            <? } ?>
         </table>
         <div align="right" style="padding: 5px;" class="contentfont"><a href="<?=process_link('wanted_ads');?>"><?=MSG_VIEW_ALL;?></a></div>
      </div>
		<? } ?>
      <? if ($setts['enable_reverse_auctions'] && $layout['r_recent_nb']) { ?>
      <div class="TabbedPanelsContent"> <br>
         <table width="100%" border="0" cellspacing="1" cellpadding="3">
			<?
		   $columns = 3;
		   $nb_reverse = $db->num_rows($sql_select_recent_reverse);
		
			for($i = 0; $i < $nb_reverse; $i++)
			{
				$item_details = mysql_fetch_array($sql_select_recent_reverse);
				
				if($i % $columns == 0) { ?>
            <tr height="15" valign="top">
				<? } ?>
               <td width="33%"><table width="100%" border="0" cellpadding="3" cellspacing="1"  class="border">
                     <tr height="215">
                        <td align="center">
                           <div class="c1feat"><a href="<?=process_link('reverse_details', array('name' => $item_details['name'], 'reverse_id' => $item_details['reverse_id']));?>">
                              <?=title_resize($item_details['name']);?>
                              </a></div>
                           <br>
                           <?=GMSG_START_TIME;?>: <?=show_date($item_details['start_time']);?><br>
                           <?=MSG_BUDGET;?>: <? echo $feat_fees->budget_output($item_details['budget_id'], null, $item_details['currency']);?>  <br>
                           <?=MSG_NR_BIDS;?>: <? echo $item_details['nb_bids'];?> <br>
                        </td>
                     </tr>
                  </table></td>
				<? if(($i % $columns) == ($columns - 1) || ($i + 1) == $nb_reverse) { ?>
            </tr>
            <? } ?>
            <? } ?>
         </table>
         <div align="right" style="padding: 5px;" class="contentfont"><a href="<?=process_link('reverse_auctions');?>"><?=MSG_VIEW_ALL;?></a></div>
      </div>
		<? } ?>
   </div>
</div>
</td>
<td width="10"><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="10" height="1"></td>
<td><? if ($is_news && $layout['d_news_box']) { ?>
   <?=$news_box_header;?>
   <?=$news_box_content;?>
   <div><img src='themes/<?=$setts['default_theme'];?>/img/pixel.gif' width='1' height='10'></div>
   <? } ?>
   <? if ($is_announcements && $member_active == 'Active') { ?>
   <?=$announcements_box_header;?>
   <div id="exp1102170555">
      <?=$announcements_box_content;?>
   </div>
   <div><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="10"></div>
   <? } ?>
   <noscript>
   <?=MSG_JS_NOT_SUPPORTED;?>
   </noscript>
   <? if ($setts['enable_header_counter']) { ?>
   <?=$header_site_status;?>
   <table width='100%' border='0' cellpadding='2' cellspacing='1' class='border'>
      <tr class='c1'>
         <td width='20%' align='center'><b>
            <?=$nb_site_users;?>
            </b></td>
         <td width='80%'>&nbsp;
            <?=MSG_REGISTERED_USERS;?></td>
      </tr>
      <tr class='c2'>
         <td width='20%' align='center'><b>
            <?=$nb_live_auctions;?>
            </b></td>
         <td width='80%'>&nbsp;
            <?=MSG_LIVE_AUCTIONS;?></td>
      </tr>
      <? if ($setts['enable_wanted_ads']) { ?>
      <tr class='c1'>
         <td width='20%' align='center'><b>
            <?=$nb_live_wanted_ads;?>
            </b></td>
         <td width='80%'>&nbsp;
            <?=MSG_LIVE_WANT_ADS;?></td>
      </tr>
      <? } ?>
      <tr class='c2'>
         <td width='20%' align='center'><b>
            <?=$nb_online_users;?>
            </b></td>
         <td width='80%'>&nbsp;
            <?=MSG_ONLINE_USERS;?></td>
      </tr>
   </table>
   <div><img src='themes/<?=$setts['default_theme'];?>/img/pixel.gif' width='1' height='10'></div>
   <? } ?>
   <?=$banner_position[3];?>
   <?=$banner_position[4];?>
<div><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="170" height="1"></div>

No, that is a template file (mainpage.tpl.php). I already have a copy of it. You probably use another script in which it calls mainpage.tpl.php. I need the name and source code of that one. Do you have one that named mainpage.php?

Hi tom8, I hope this the one :slight_smile:

<?
#################################################################
## index.php												##
##-------------------------------------------------------------##
## Copyright 2012. All rights reserved.                 	##
##-------------------------------------------------------------##
#################################################################

session_start();

define ('IN_SITE', 1);
define ('INDEX_PAGE', 1); ## for integration

if (!file_exists('includes/config.php')) echo "<script>document.location.href='install/install.php'</script>";

include_once ('includes/global.php');

include_once ('includes/functions_login.php');
include_once ('includes/functions_item.php');

if (eregi('logout', $_GET['option']))
{
	logout();
}

include_once ('global_header.php');

if (isset($_GET['change_language']))
{
	$all_languages = list_languages('site');

	if (in_array($_GET['change_language'], $all_languages))
	{
		$session->set('site_lang', $_GET['change_language']);
	}

	$refresh_link = 'index.php';

	$template_output .= '<br><p class="contentfont" align="center">' . MSG_SITE_LANG_CHANGED . '<br><br>
		Please click <a href="' . process_link('index') . '">' . MSG_HERE . '</a> ' . MSG_PAGE_DOESNT_REFRESH . '</p>';
	$template_output .= '<script>window.setTimeout(\\'changeurl();\\',300); function changeurl(){window.location=\\'' . $refresh_link . '\\'}</script>';
}
else if (isset($_GET['change_skin']))
{
	$all_skins = list_skins('site');

	if (in_array($_GET['default_theme'], $all_skins))
	{
		$session->set('site_theme', $_GET['default_theme']);
	}

	$refresh_link = 'index.php';

	$template_output .= '<br><p class="contentfont" align="center">' . MSG_SITE_SKIN_CHANGED . '<br><br>
		Please click <a href="' . process_link('index') . '">' . MSG_HERE . '</a> ' . MSG_PAGE_DOESNT_REFRESH . '</p>';
	$template_output .= '<script>window.setTimeout(\\'changeurl();\\',300); function changeurl(){window.location=\\'' . $refresh_link . '\\'}</script>';	
}
else
{
	include_once ('global_mainpage.php');
}

include_once ('global_footer.php');

echo $template_output;

?>

Ok, I think we’re getting somewhere. Hopefully this file will be the last one I need:
global_mainpage.php

Please post the source code.

Edit: might as well give me the source code for this one too:
includes/functions_item.php

Hi tom8, i like the sound of “I think we’re getting somewhere” :slight_smile:

<?
#################################################################
## global_mainpage.php										##
##-------------------------------------------------------------##
## Copyright 2012. All rights reserved.                     ##
##-------------------------------------------------------------##
#################################################################

if ($layout['hpfeat_nb'])## PHP Pro Bid v6.00 home page featured auctions
{
	$featured_auctions_header = header1(MSG_FEATURED_AUCTIONS . ' [ <span class="sell"><a href="' . process_link('auctions_show', array('option' => 'featured')) . '">' . MSG_VIEW_ALL . '</a></span> ]');
	$template->set('featured_auctions_header', $featured_auctions_header);

	$select_condition = "WHERE
		hpfeat=1 AND active=1 AND approved=1 AND closed=0 AND creation_in_progress=0 AND deleted=0 AND
		list_in!='store'";

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

	$template->set('feat_fees', $fees);
	$template->set('feat_db', $db);

	$item_details = $db->random_rows('auctions', 'auction_id, name, start_price, max_bid, currency, end_time', $select_condition, $layout['hpfeat_max']);
	$template->set('item_details', $item_details);
}

if ($layout['r_hpfeat_nb'] && $setts['enable_reverse_auctions'])
{
	$featured_reverse_auctions_header = header1(MSG_FEATURED_REVERSE_AUCTIONS);
	$template->set('featured_reverse_auctions_header', $featured_reverse_auctions_header);

	$select_condition = "WHERE
		hpfeat=1 AND active=1 AND closed=0 AND creation_in_progress=0 AND deleted=0";

	$template->set('featured_ra_columns', min((floor($db->count_rows('reverse_auctions', $select_condition)/$layout['r_hpfeat_nb']) + 1), ceil($layout['r_hpfeat_max']/$layout['r_hpfeat_nb'])));

	$template->set('feat_fees', $fees);
	$template->set('feat_db', $db);

	$ra_details = $db->random_rows('reverse_auctions', 'reverse_id, name, budget_id, nb_bids, currency, end_time', $select_condition, $layout['r_hpfeat_max']);
	$template->set('ra_details', $ra_details);
}

if ($layout['nb_recent_auct'])
{
	$recent_auctions_header = header2(MSG_RECENTLY_LISTED_AUCTIONS . ' [ <span class="sell"><a href="' . process_link('auctions_show', array('option' => 'recent')) . '">' . MSG_VIEW_ALL . '</a></span> ]');
	$template->set('recent_auctions_header', $recent_auctions_header);

	$sql_select_recent_items = $db->query("SELECT auction_id, start_time, start_price, currency, name,
		bold, hl, buyout_price, is_offer, reserve_price, max_bid, nb_bids, owner_id, postage_amount FROM " . DB_PREFIX . "auctions
		FORCE INDEX (auctions_start_time) WHERE
		closed=0 AND active=1 AND approved=1 AND deleted=0 AND creation_in_progress=0 AND
		list_in!='store' ORDER BY start_time DESC LIMIT 0," . $layout['nb_recent_auct']);

	$template->set('sql_select_recent_items', $sql_select_recent_items);
}

if ($layout['nb_popular_auct'])
{
	$popular_auctions_header = header3(MSG_POPULAR_AUCTIONS . ' [ <span class="sell"><a href="' . process_link('auctions_show', array('option' => 'popular')) . '">' . MSG_VIEW_ALL . '</a></span> ]');
	$template->set('popular_auctions_header', $popular_auctions_header);

	$sql_select_popular_items = $db->query("SELECT auction_id, max_bid, currency, name, bold, hl,
		buyout_price, is_offer, reserve_price, nb_bids, owner_id, postage_amount FROM " . DB_PREFIX . "auctions
		FORCE INDEX (auctions_max_bid) WHERE
		closed=0 AND active=1 AND approved=1 AND deleted=0 AND creation_in_progress=0 AND
		list_in!='store' AND nb_bids>0 ORDER BY max_bid DESC LIMIT 0," . $layout['nb_popular_auct']);

	$template->set('sql_select_popular_items', $sql_select_popular_items);
	
	$is_popular_items = $db->num_rows($sql_select_popular_items);
	$template->set('is_popular_items', $is_popular_items);
}

if ($layout['nb_ending_auct'])
{
	$ending_auctions_header = header4(MSG_ENDING_SOON_AUCTIONS . ' [ <span class="sell"><a href="' . process_link('auctions_show', array('option' => 'ending')) . '">' . MSG_VIEW_ALL . '</a></span> ]');
	$template->set('ending_auctions_header', $ending_auctions_header);

	 $sql_select_ending_items = $db->query("SELECT auction_id, start_price, max_bid, end_time, currency, name, bold,
		hl, buyout_price, is_offer, reserve_price, nb_bids, owner_id, postage_amount, auction_type FROM " . DB_PREFIX . "auctions
		FORCE INDEX (auctions_end_time) WHERE
		closed=0 AND active=1 AND approved=1 AND deleted=0 AND creation_in_progress=0 AND
		list_in!='store' AND auction_type!='first_bidder' ORDER BY end_time ASC LIMIT 0," . $layout['nb_ending_auct']);

	$template->set('sql_select_ending_items', $sql_select_ending_items);
}

if ($layout['nb_want_ads'])
{
	$recent_wa_header = header4(MSG_RECENTLY_LISTED_WANTED_ADS . ' [ <span class="sell"><a href="' . process_link('wanted_ads') . '">' . MSG_VIEW_ALL . '</a></span> ]');
	$template->set('recent_wa_header', $recent_wa_header);

	$sql_select_recent_wa = $db->query("SELECT wanted_ad_id, start_time, name FROM " . DB_PREFIX . "wanted_ads
		FORCE INDEX (wa_mainpage) WHERE
		closed=0 AND active=1 AND deleted=0 AND creation_in_progress=0 ORDER BY
		start_time DESC LIMIT 0," . $layout['nb_want_ads']);

	$template->set('sql_select_recent_wa', $sql_select_recent_wa);
}

if ($layout['r_recent_nb'] && $setts['enable_reverse_auctions'])
{
	$recent_reverse_header = header4(MSG_MM_REVERSE_AUCTIONS . ' [ <span class="sell"><a href="' . process_link('reverse_auctions') . '">' . MSG_VIEW_ALL . '</a></span> ]');
	$template->set('recent_reverse_header', $recent_reverse_header);

	$sql_select_recent_reverse = $db->query("SELECT reverse_id, name, budget_id, nb_bids, currency, start_time, end_time FROM " . DB_PREFIX . "reverse_auctions
		WHERE	closed=0 AND active=1 AND deleted=0 AND creation_in_progress=0 ORDER BY
		start_time DESC LIMIT 0," . $layout['r_recent_nb']);

	$template->set('sql_select_recent_reverse', $sql_select_recent_reverse);
}


$template->change_path('themes/' . $setts['default_theme'] . '/templates/');

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

$template->change_path('templates/');

?>

Ok, hopefully this update will work:

First update this line in global_mainpage.php (line 23):
$item_details = $db->random_rows(‘auctions’, ‘auction_id, name, start_price, max_bid, currency, end_time’, $select_condition, $layout[‘hpfeat_max’]);

to this:
$item_details = $db->random_rows(‘auctions’, ‘auction_id, name, start_price, max_bid, currency, end_time, country’, $select_condition, $layout[‘hpfeat_max’]);

Next insert this at line 16 in mainpage.tpl.php (just below $counter = 0):
$tax = new tax();

Finally add this code just above <b><?=MSG_START_BID…
<b><?=MSG_COUNTRY;?></b>
<?
$country = $tax->display_countries($item_details[$counter][‘country’]);
echo $item_details[$counter][‘country’].“- $country<br>”;
?>

Note, if you getting error using $tax then remove it. We will figure it out later.

I have more questions than answers, and it’s all about your markup… in the latter one why is that even a table… in the former one why are you using TD+B to do TH’s job? Of course the constant opening and closing php on every line means IMHO flawed methodology too so…

I assume OP has limited PHP knowledge (Ray, correct me if I’m wrong :blush:) so my aim is to come up with a solution in which the country name will be shown. This is the answer he seeks. I think we are getting close to that. As far as coding, I agree that there are way too many php tags and the markup could make better by consolidating them. I will let him to decide the next step to take.

Hello tom8, thank you for all your help :slight_smile:

ok great :slight_smile: new code added, and the results can be seen on www.trade-th.com

but? what is the 2070 before the word Thailand? should that be 2012?

You will also see I added the code to the Recently Listed Auctions on the Homepage, yet the country is missing.

I did add the word country in the global_mainpage.php in the Recently Listed Auctions code:

if ($layout[‘nb_recent_auct’])
{
$recent_auctions_header = header2(MSG_RECENTLY_LISTED_AUCTIONS . ’ [ <span class=“sell”><a href=“’ . process_link(‘auctions_show’, array(‘option’ => ‘recent’)) . '”>’ . MSG_VIEW_ALL . ‘</a></span> ]’);
$template->set(‘recent_auctions_header’, $recent_auctions_header);

$sql_select_recent_items = $db-&gt;query("SELECT auction_id, start_time, start_price, currency, name, [B]country[/B],
	bold, hl, buyout_price, is_offer, reserve_price, max_bid, nb_bids, owner_id, postage_amount FROM "

I also tried modifying the code to show location.

<b><?=MSG_LOCATION;?></b>
<?
$location = $tax->display_locations($item_details[$counter][‘location’]);
echo $item_details[$counter][‘location’].“- $location<br>”;
?>

yet no luck there … lol

about the 2070, an idea, I originally was wanting to add this code:

<tr><td nowrap><b><?=MSG_LOCATION;?></b>:</td>
      <td width="100%"><?=$auction_location;?></td>
</tr>

<tr><td nowrap><b><?=MSG_COUNTRY;?></b>:</td>
      <td><?=$auction_country;?></td>
</tr>

is action_country the same as country does is call/find the same data?

2070 is the country code. It is not needed so remove it from the display if you want. I just want to make sure it can be extracted from the database.

I will look over the new code you shown in the morning. It is getting late here… zzzzz

Hello tom8, ok, thank you for your continued help and support,

morning here in Bangkok, another hot hot sunny day, :slight_smile:

happy zzzzzz

Morning!

Now that we know where to get the Country name you can shorten the code from this
<b><?=MSG_COUNTRY;?></b>
<?
$country = $tax->display_countries($item_details[$counter][‘country’]);
echo $item_details[$counter][‘country’].“- $country<br>”;
?>

to this
<b><?=MSG_COUNTRY;?>: </b> <? echo $tax->display_countries($item_details[$counter][‘country’]);?> <br>

And for the Recently Listed Auctions you need to insert this line:
<?=MSG_LOCATION;?>: <? echo $tax->display_countries($item_details[‘country’]);?><br>

Make those changes and let me know what else you need to change.

Evening!

ok tom8 all your new code implemented and working 110 % :slight_smile:

many thank yous :slight_smile:

could you now help me with the Location code

Country : Thailand
Location : 10500, Central Region - Bangkok

<?=MSG_LOCATION;?>: <? echo $tax->display_locations($item_details[‘location’]);?><br>

I’m glad that my help is better than expected (110% :)).

Unfortunately as per the database dump there is no location ($item_details[‘location’]).

If there is a function named display locations, you may want to try this:
<?=MSG_LOCATION;?>: <? echo $tax->display_locations($item_details[‘country’]);?><br>

Hi tom8,

the original code I copied from the auction_details.php was

<tr><td nowrap><b><?=MSG_LOCATION;?></b>:</td>
      <td width="100%"><?=$auction_location;?></td>
</tr>

<tr><td nowrap><b><?=MSG_COUNTRY;?></b>:</td>
      <td><?=$auction_country;?></td>
</tr>

Location : 10500, Central Region - Bangkok
Country : Thailand
Time Left : 42 days, 17h 4m
Start Time : Apr. 19, 2012 07:32:00
End Time : Jun. 14, 2012 07:32:00

the Location and Country is what I was wanting to reproduce/show on the main page/ index.php / mainpage.tpl.ph

the Country & Location is entered at the Registration stage, so each member has possible a different Location/City were they live.

that is why $auction_country $auction_location was called as each Auction listed could be at a different Location,

:slight_smile:

Hi tom8,

the details/data I think is pulled from data base: users

SQL query:
SELECT *
FROM users
LIMIT 0 , 30

user_id - 10001
name
email
birthdate
address
city - Bangkok
state
country - 2070
zip_code
phone
username

so the ‘user’ Members Country and City (Location) are displayed with the Ad :slight_smile:

Post the source code from this file may help me:

includes/functions_item.php

<?
#################################################################
## \\includes\\functions_item.php								##
##-------------------------------------------------------------##
## Copyright 2012. All rights reserved.	                    ##
##-------------------------------------------------------------##
#################################################################

function nav_btns_position($submit = false, $save_draft = false)
{
	global $setts;
	(string) $display_output = null;

	$next_step_btn = ($submit) ? GMSG_LIST_NOW : GMSG_NEXT_STEP;

	$buttons = array(
		'previous' => '<input name="form_previous_step" type="submit" id="form_previous_step" value="' . GMSG_PREV_STEP . '" />',
		'next' => '<input name="form_next_step" type="submit" id="form_next_step" value="' . $next_step_btn . '" />',
		'draft' => '<input name="form_save_draft" type="submit" id="form_save_draft" value="' . GMSG_SAVE_AS_DRAFT . '" />');

	if ($setts['sell_nav_position'] == 1)
	{
		$display_output = $buttons['previous'] . ' &nbsp; ' . $buttons['next'];
	}
	else if ($setts['sell_nav_position'] == 2)
	{
		$display_output = $buttons['next'] . ' &nbsp; ' . $buttons['previous'];
	}
	
	if ($save_draft)
	{
		$display_output .= ' &nbsp; ' . $buttons['draft'];
	}
	
	return $display_output;
}

function show_buyout($item_details) // max_bid, reserve_price, buyout_price, nb_bids
{
	global $layout, $setts;

	$output = false;

	if ($layout['enable_buyout'] && $setts['buyout_process'] == 1 && $item_details['buyout_price'] > 0 && $item_details['closed'] == 0)
	{
		if ($setts['always_show_buyout'])
		{
			$output = ($item_details['max_bid'] > $item_details['buyout_price']) ? false : true;
		}
		else
		{
			if ($item_details['nb_bids'] <= 0)
			{
				$output = true;
			}
			else
			{
				if ($item_details['reserve_price'])
				{
					$output = ($item_details['max_bid'] < $item_details['reserve_price']) ? true : false;
				}
				else
				{
					$output = false;
				}
			}
		}
	}

	return $output;
}

function show_makeoffer($item_details)
{
	global $layout, $setts;

	$output = false;

	if ($layout['enable_buyout'] && $setts['makeoffer_process'] == 1 && $item_details['closed'] == 0)
	{
		if ($setts['always_show_buyout'])
		{
			$output = ($item_details['max_bid'] > $item_details['offer_max']) ? false : true;
		}
		else
		{
			if ($item_details['nb_bids'] <= 0)
			{
				$output = true;
			}
			else
			{
				if ($item_details['reserve_price'])
				{
					$output = ($item_details['max_bid'] < $item_details['reserve_price']) ? true : false;
				}
				else
				{
					$output = false;
				}
			}
		}
	}

	return $output;
}

function item_pics($item_details)
{
	global $setts, $db, $session;
	(string) $display_output = null;

	$is_images = $db->count_rows('auction_media', "WHERE auction_id='" . $item_details['auction_id'] . "' AND
		media_type=1 AND upload_in_progress=0");

	if ($is_images)
	{
		$display_output .= '<img src="themes/' . $setts['default_theme'] . '/img/system/camera1.gif" border="0" align="absmiddle" alt="' . $item_details['name'] . '"> ';
	}
	
	$show_buyout = show_buyout($item_details);

	if ($setts['buyout_process'] == 1 && $show_buyout)
	{
		$image_link = '<img src="themes/' . $setts['default_theme'] . '/img/system/buyitnow25.gif" border="0" align="absmiddle" alt="' . GMSG_BUYOUT . '">';

		if ($session->value('user_id') != $item_details['owner_id'])
		{
			$display_output .= '<a href="' . process_link('buy_out', array('auction_id' => $item_details['auction_id'], 'name' => $item_details['name'])) . '">' . $image_link . '</a>';			
		}
		else
		{
			$display_output .= $image_link;
		}
	}

	if ($setts['makeoffer_process'] == 1 && $item_details['is_offer'])
	{
		$image_link = '<img src="themes/' . $setts['default_theme'] . '/img/system/makeoffer25.gif" border="0" align="absmiddle" alt="' . GMSG_MAKE_OFFER . '">';
		
		if ($session->value('user_id') != $item_details['owner_id'])
		{
			$display_output .= '<a href="' . process_link('make_offer', array('auction_id' => $item_details['auction_id'], 'name' => $item_details['name'])) . '">' . $image_link . '</a>';
		}
		else
		{
			$display_output .= $image_link;
		}
	}

	/*
	if ($item_details['postage_amount'] <= 0)
	{
		$display_output .= ' <img src="images/freeshipping.gif" border="0" align="absmiddle" alt="' . GMSG_FREE_SHIPPING . '"> ';		
	}
	*/
	
	return $display_output;
}
?>

It not in the item and I didn’t see your post about the user database so please post the source code of this one:

includes/class_user.php

Hopefully the answer is in there.