[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/templates/fallback/content/ -> articles.tpl.php (source)

   1  <table border="0" width="100%" cellspacing="3" cellpadding="3">
   2    <tr>
   3      <!-- body_text //-->
   4      <?php
   5    if ($topic_depth == 'nested') {
   6      $topic_query = tep_db_query("select td.topics_name, td.topics_heading_title, td.topics_description from " . TABLE_TOPICS . " t, " . TABLE_TOPICS_DESCRIPTION . " td where t.topics_id = '" . (int)$current_topic_id . "' and td.topics_id = '" . (int)$current_topic_id . "' and td.language_id = '" . (int)$languages_id . "'");
   7      $topic = tep_db_fetch_array($topic_query);
   8  ?>
   9      <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  10          <tr>
  11            <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  12                <tr>
  13                  <td valign="top" class="pageHeading">
  14                    <?php
  15  /* bof catdesc for bts1a, replacing "echo HEADING_TITLE;" by "topics_heading_title" */
  16               if ( tep_not_null($topic['topics_heading_title']) ) {
  17                   echo $topic['topics_heading_title'];
  18                 } else {
  19                   echo HEADING_TITLE;
  20                 }
  21  /* eof catdesc for bts1a */ ?>
  22                  </td>
  23                  <td valign="top" class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . $topic['topics_image'], $topic['topics_name'], HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
  24                </tr>
  25                <?php if ( tep_not_null($topic['topics_description']) ) { ?>
  26                <tr>
  27                  <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  28                </tr>
  29                <tr>
  30                  <td align="left" colspan="2" class="main"><?php echo $topic['topics_description']; ?></td>
  31                </tr>
  32                <tr>
  33                  <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  34                </tr>
  35                <?php } ?>
  36              </table></td>
  37          </tr>
  38          <tr>
  39            <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  40          </tr>
  41          <tr>
  42            <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
  43                <tr>
  44                  <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
  45                      <tr>
  46                        <?php
  47      if (isset($tPath) && strpos('_', $tPath)) {
  48  // check to see if there are deeper topics within the current topic
  49        $topic_links = array_reverse($tPath_array);
  50        for($i=0, $n=sizeof($topic_links); $i<$n; $i++) {
  51          $topics_query = tep_db_query("SELECT COUNT(*) as total from " . TABLE_TOPICS . " t, " . TABLE_TOPICS_DESCRIPTION . " td where t.parent_id = '" . (int)$topic_links[$i] . "' and t.topics_id = td.topics_id and td.language_id = '" . (int)$languages_id . "'");
  52          $topics = tep_db_fetch_array($topics_query);
  53          if ($topics['total'] < 1) {
  54            // do nothing, go through the loop
  55          } else {
  56            $topics_query = tep_db_query("select t.topics_id, td.topics_name, t.parent_id from " . TABLE_TOPICS . " t, " . TABLE_TOPICS_DESCRIPTION . " td where t.parent_id = '" . (int)$topic_links[$i] . "' and t.topics_id = td.topics_id and td.language_id = '" . (int)$languages_id . "' order by sort_order, td.topics_name");
  57            break; // we've found the deepest topic the customer is in
  58          }
  59        }
  60      } else {
  61        $topics_query = tep_db_query("select t.topics_id, td.topics_name, t.parent_id from " . TABLE_TOPICS . " t, " . TABLE_TOPICS_DESCRIPTION . " td where t.parent_id = '" . (int)$current_topic_id . "' and t.topics_id = td.topics_id and td.language_id = '" . (int)$languages_id . "' order by sort_order, td.topics_name");
  62      }
  63  
  64  // needed for the new articles module shown below
  65      $new_articles_topic_id = $current_topic_id;
  66  ?>
  67                </tr>
  68              </table></td>
  69            </tr>
  70                <tr>
  71                  <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  72                </tr>
  73                <tr>
  74                  <td>
  75                    <?php /*include(DIR_WS_MODULES . FILENAME_NEW_ARTICLES); */ ?>
  76                  </td>
  77                </tr>
  78              </table></td>
  79          </tr>
  80        </table></td>
  81      <?php
  82    } elseif ($topic_depth == 'articles' || isset($HTTP_GET_VARS['authors_id'])) {
  83  
  84  /* bof catdesc for bts1a */
  85  // Get the topic name and description from the database
  86      $topic_query = tep_db_query("select td.topics_name, td.topics_heading_title, td.topics_description from " . TABLE_TOPICS . " t, " . TABLE_TOPICS_DESCRIPTION . " td where t.topics_id = '" . (int)$current_topic_id . "' and td.topics_id = '" . (int)$current_topic_id . "' and td.language_id = '" . (int)$languages_id . "'");
  87      $topic = tep_db_fetch_array($topic_query);
  88  /* bof catdesc for bts1a */
  89  
  90  // show the articles of a specified author
  91      if (isset($HTTP_GET_VARS['authors_id'])) {
  92        if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
  93  // We are asked to show only a specific topic
  94          $listing_sql = "select a.articles_id, a.authors_id, a.articles_date_added, ad.articles_name, ad.articles_head_desc_tag, au.authors_name, td.topics_name, a2t.topics_id from " . TABLE_ARTICLES . " a left join " . TABLE_AUTHORS . " au using(authors_id), " . TABLE_ARTICLES_DESCRIPTION . " ad, " . TABLE_ARTICLES_TO_TOPICS . " a2t left join " . TABLE_TOPICS_DESCRIPTION . " td using(topics_id) where (a.articles_date_available IS NULL or to_days(a.articles_date_available) <= to_days(now())) and a.articles_status = '1' and au.authors_id = '" . (int)$HTTP_GET_VARS['authors_id'] . "' and a.articles_id = a2t.articles_id and ad.articles_id = a2t.articles_id and ad.language_id = '" . (int)$languages_id . "' and td.language_id = '" . (int)$languages_id . "' and a2t.topics_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' order by a.articles_date_added desc, ad.articles_name";
  95        } else {
  96  // We show them all
  97          $listing_sql = "select a.articles_id, a.authors_id, a.articles_date_added, ad.articles_name, ad.articles_head_desc_tag, au.authors_name, td.topics_name, a2t.topics_id from " . TABLE_ARTICLES . " a left join " . TABLE_AUTHORS . " au using(authors_id), " . TABLE_ARTICLES_DESCRIPTION . " ad, " . TABLE_ARTICLES_TO_TOPICS . " a2t left join " . TABLE_TOPICS_DESCRIPTION . " td using(topics_id) where (a.articles_date_available IS NULL or to_days(a.articles_date_available) <= to_days(now())) and a.articles_status = '1' and au.authors_id = '" . (int)$HTTP_GET_VARS['authors_id'] . "' and a.articles_id = a2t.articles_id and ad.articles_id = a2t.articles_id and ad.language_id = '" . (int)$languages_id . "' and td.language_id = '" . (int)$languages_id . "' order by a.articles_date_added desc, ad.articles_name";
  98        }
  99      } else {
 100  // show the articles in a given category
 101        if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
 102  // We are asked to show only specific catgeory
 103          $listing_sql = "select a.articles_id, a.authors_id, a.articles_date_added, ad.articles_name, ad.articles_head_desc_tag, au.authors_name, td.topics_name, a2t.topics_id from " . TABLE_ARTICLES . " a left join " . TABLE_AUTHORS . " au using(authors_id), " . TABLE_ARTICLES_DESCRIPTION . " ad, " . TABLE_ARTICLES_TO_TOPICS . " a2t left join " . TABLE_TOPICS_DESCRIPTION . " td using(topics_id) where (a.articles_date_available IS NULL or to_days(a.articles_date_available) <= to_days(now())) and a.articles_status = '1' and a.articles_id = a2t.articles_id and ad.articles_id = a2t.articles_id and ad.language_id = '" . (int)$languages_id . "' and td.language_id = '" . (int)$languages_id . "' and a2t.topics_id = '" . (int)$current_topic_id . "' and au.authors_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' order by a.articles_date_added desc, ad.articles_name";
 104        } else {
 105  // We show them all
 106          $listing_sql = "select a.articles_id, a.authors_id, a.articles_date_added, ad.articles_name, ad.articles_head_desc_tag, au.authors_name, td.topics_name, a2t.topics_id from " . TABLE_ARTICLES . " a left join " . TABLE_AUTHORS . " au using(authors_id), " . TABLE_ARTICLES_DESCRIPTION . " ad, " . TABLE_ARTICLES_TO_TOPICS . " a2t left join " . TABLE_TOPICS_DESCRIPTION . " td using(topics_id) where (a.articles_date_available IS NULL or to_days(a.articles_date_available) <= to_days(now())) and a.articles_status = '1' and a.articles_id = a2t.articles_id and ad.articles_id = a2t.articles_id and ad.language_id = '" . (int)$languages_id . "' and td.language_id = '" . (int)$languages_id . "' and a2t.topics_id = '" . (int)$current_topic_id . "' order by a.articles_date_added desc, ad.articles_name";
 107        }
 108      }
 109  ?>
 110      <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
 111        <tr>
 112          <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
 113                <tr>
 114                  <td valign="top" align="left" class="pageHeading">
 115                    <?php
 116             /* bof catdesc for bts1a, replacing "echo HEADING_TITLE;" by "topics_heading_title" */
 117                 if ( tep_not_null($topic['topics_heading_title']) ) {
 118                   echo $topic['topics_heading_title'];
 119                 } else {
 120                   echo HEADING_TITLE;
 121                 }
 122  
 123               if (isset($HTTP_GET_VARS['authors_id'])) {
 124                 $author_query = tep_db_query("select au.authors_name, aui.authors_description, aui.authors_url from " . TABLE_AUTHORS . " au, " . TABLE_AUTHORS_INFO . " aui where au.authors_id = '" . (int)$HTTP_GET_VARS['authors_id'] . "' and au.authors_id = aui.authors_id and aui.languages_id = '" . (int)$languages_id . "'");
 125                 $authors = tep_db_fetch_array($author_query);
 126                 $author_name = $authors['authors_name'];
 127                 $authors_description = $authors['authors_description'];
 128                 $authors_url = $authors['authors_url'];
 129  
 130                 echo TEXT_ARTICLES_BY . $author_name;
 131               }
 132  
 133             /* eof catdesc for bts1a */
 134             ?>
 135                  </td>
 136                  <?php
 137  // optional Article List Filter
 138      if (ARTICLE_LIST_FILTER) {
 139        if (isset($HTTP_GET_VARS['authors_id'])) {
 140          $filterlist_sql = "select distinct t.topics_id as id, td.topics_name as name from " . TABLE_ARTICLES . " a, " . TABLE_ARTICLES_TO_TOPICS . " a2t, " . TABLE_TOPICS . " t, " . TABLE_TOPICS_DESCRIPTION . " td where a.articles_status = '1' and a.articles_id = a2t.articles_id and a2t.topics_id = t.topics_id and a2t.topics_id = td.topics_id and td.language_id = '" . (int)$languages_id . "' and a.authors_id = '" . (int)$HTTP_GET_VARS['authors_id'] . "' order by td.topics_name";
 141        } else {
 142          $filterlist_sql= "select distinct au.authors_id as id, au.authors_name as name from " . TABLE_ARTICLES . " a, " . TABLE_ARTICLES_TO_TOPICS . " a2t, " . TABLE_AUTHORS . " au where a.articles_status = '1' and a.authors_id = au.authors_id and a.articles_id = a2t.articles_id and a2t.topics_id = '" . (int)$current_topic_id . "' order by au.authors_name";
 143        }
 144        $filterlist_query = tep_db_query($filterlist_sql);
 145        if (tep_db_num_rows($filterlist_query) > 1) {
 146          echo '<td align="right" class="main">' . tep_draw_form('filter', FILENAME_ARTICLES, 'get') . TEXT_SHOW . '&nbsp;';
 147          if (isset($HTTP_GET_VARS['authors_id'])) {
 148            echo tep_draw_hidden_field('authors_id', $HTTP_GET_VARS['authors_id']);
 149            $options = array(array('id' => '', 'text' => TEXT_ALL_TOPICS));
 150          } else {
 151            echo tep_draw_hidden_field('tPath', $tPath);
 152            $options = array(array('id' => '', 'text' => TEXT_ALL_AUTHORS));
 153          }
 154          echo tep_draw_hidden_field('sort', $HTTP_GET_VARS['sort']);
 155          while ($filterlist = tep_db_fetch_array($filterlist_query)) {
 156            $options[] = array('id' => $filterlist['id'], 'text' => $filterlist['name']);
 157          }
 158          echo tep_draw_pull_down_menu('filter_id', $options, (isset($HTTP_GET_VARS['filter_id']) ? $HTTP_GET_VARS['filter_id'] : ''), 'onchange="this.form.submit()"');
 159          echo '</form></td>' . "\n";
 160        }
 161      }
 162  ?>
 163                </tr>
 164                <?php if ( tep_not_null($topic['topics_description']) ) { ?>
 165                <tr>
 166                  <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 167                </tr>
 168                <tr>
 169                  <td align="left" colspan="2" class="main"><?php echo $topic['topics_description']; ?></td>
 170                </tr>
 171                <tr>
 172                  <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 173                </tr>
 174                <?php } ?>
 175                <?php if (tep_not_null($authors_description)) { ?>
 176                <tr>
 177                  <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 178                </tr>
 179                <tr>
 180                  <td class="main" colspan="2" valign="top"><?php echo $authors_description; ?></td>
 181                <tr>
 182                  <?php } ?>
 183                  <?php if (tep_not_null($authors_url)) { ?>
 184                <tr>
 185                  <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 186                </tr>
 187                <tr>
 188                  <td class="main" colspan="2" valign="top"><?php echo sprintf(TEXT_MORE_INFORMATION, $authors_url); ?></td>
 189                <tr>
 190                <tr>
 191                  <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
 192                </tr>
 193                <?php } ?>
 194              </table></td>
 195          </tr>
 196          <tr>
 197            <td>
 198              <?php include(DIR_WS_MODULES . FILENAME_ARTICLE_LISTING); ?>
 199            </td>
 200          </tr>
 201        </table></td>
 202      <?php
 203    } else { // default page
 204  ?>
 205      <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
 206          <tr>
 207            <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
 208                <tr>
 209                  <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
 210                </tr>
 211              </table></td>
 212          </tr>
 213          <tr>
 214            <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 215          </tr>
 216          <tr>
 217            <td>
 218              <?php include(DIR_WS_MODULES . FILENAME_ARTICLES_UPCOMING); ?>
 219            </td>
 220          </tr>
 221          <tr>
 222            <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 223          </tr>
 224          <tr>
 225            <td class="main"><?php echo '<b>' . TEXT_CURRENT_ARTICLES . '</b>'; ?></td>
 226          </tr>
 227          <tr>
 228            <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 229          </tr>
 230          <?php
 231    $articles_all_array = array();
 232    $articles_all_query_raw = "select a.articles_id, a.articles_date_added, ad.articles_name, ad.articles_head_desc_tag, au.authors_id, au.authors_name, td.topics_id, td.topics_name from ((" . TABLE_ARTICLES . " a), " . TABLE_ARTICLES_TO_TOPICS . " a2t) left join " . TABLE_TOPICS_DESCRIPTION . " td on a2t.topics_id = td.topics_id left join " . TABLE_AUTHORS . " au on a.authors_id = au.authors_id, " . TABLE_ARTICLES_DESCRIPTION . " ad where (a.articles_date_available IS NULL or to_days(a.articles_date_available) <= to_days(now())) and a.articles_id = a2t.articles_id and a.articles_status = '1' and a.articles_id = ad.articles_id and ad.language_id = '" . (int)$languages_id . "' and td.language_id = '" . (int)$languages_id . "' order by a.articles_date_added desc, ad.articles_name";
 233    $listing_sql = $articles_all_query_raw;
 234  
 235    //$articles_all_split = new splitPageResults($articles_all_query_raw, MAX_ARTICLES_PER_PAGE);
 236  
 237  ?>
 238        <tr>
 239          <td><?php include(DIR_WS_MODULES . FILENAME_ARTICLE_LISTING); ?></td>
 240        </tr>
 241        
 242        
 243        
 244        
 245        
 246        
 247        <tr>
 248          <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
 249            <tr>
 250              <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 251            </tr>
 252            
 253        <tr>
 254          </table></td>
 255          </tr>
 256          <?php
 257    if (($articles_all_split->number_of_rows > 0) && ((ARTICLE_PREV_NEXT_BAR_LOCATION == 'bottom') || (ARTICLE_PREV_NEXT_BAR_LOCATION == 'both'))) {
 258  ?>
 259          <tr>
 260            <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
 261                <tr>
 262                  <td class="smallText"><?php echo $articles_all_split->display_count(TEXT_DISPLAY_NUMBER_OF_ARTICLES); ?></td>
 263                  <td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $articles_all_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
 264                </tr>
 265              </table></td>
 266          </tr>
 267          <?php
 268    }
 269  ?>
 270        </table></td>
 271      <?php } ?>
 272      <!-- body_text_eof //-->
 273    </tr>
 274  </table>


Generated: Fri Jan 1 13:43:16 2010 Cross-referenced by PHPXref 0.7