コード例 #1
0
$faq_categories_query = tep_db_query("select ic.categories_id, icd.categories_name \r\n                                        from " . TABLE_FAQ_CATEGORIES . " ic, \r\n                                        " . TABLE_FAQ_CATEGORIES_DESCRIPTION . " icd \r\n                                        where icd.categories_id = ic.categories_id         \r\n                                        and icd.language_id = '" . (int) $languages_id . "' \r\n                                        and ic.products_group_access like '%" . $customer_group_id . "%'\r\n                                        and ic.categories_status = '1' \r\n                                        order by rand()  ");
$faq_categories_check = tep_db_num_rows($faq_categories_query);
if ($faq_categories_query > 0) {
    $info_box_contents = array();
    $info_box_contents[] = array('text' => TABLE_HEADING_NEW_FAQ);
    new contentBoxHeading($info_box_contents, tep_href_link(FILENAME_FAQ));
    $info_box_contents = array();
    $row = 0;
    $count = 0;
    while ($faq_categories = tep_db_fetch_array($faq_categories_query)) {
        if (MAINPAGE_FAQ_SHOW_CATEGORY_FAQ == 'true') {
            $faq_query = tep_db_query("select ip.faq_id, ip.question \r\n                                    from " . TABLE_FAQ . " ip, \r\n                                    " . TABLE_FAQ_TO_CATEGORIES . " ip2c \r\n                                    where ip.faq_id = ip2c.faq_id \r\n                                    and ip2c.categories_id = '" . $faq_categories['categories_id'] . "' \r\n                                    and ip.products_group_access like '%" . $customer_group_id . "%'\r\n                                    and ip.language = '" . $language . "' \r\n                                    and ip.visible = '1' ");
            $faq_str = '';
            $faq_num = 0;
            while ($faq = tep_db_fetch_array($faq_query)) {
                $faq_str .= '&nbsp; &nbsp; &raquo; <a href="' . tep_href_link(FILENAME_FAQ, 'cID=' . (int) $faq_categories['categories_id']) . '#' . $faq['faq_id'] . '">' . cre_clean_html($faq['question']) . '</a><br>';
                $faq_num++;
                if ($faq_num == MAINPAGE_FAQ_NUM_FAQ) {
                    break;
                }
            }
        }
        $info_box_contents[$row][0] = array('align' => 'left', 'params' => 'class="main" valign="top"', 'text' => '<a href="' . tep_href_link(FILENAME_FAQ, 'cID=' . (int) $faq_categories['categories_id']) . '"><strong>' . $faq_categories['categories_name'] . '</strong></a><br>' . $faq_str);
        $count++;
        $row++;
        if ($count == MAX_DISPLAY_MODULES_FAQ_CATEGORY) {
            break;
        }
    }
    new contentBox($info_box_contents, true, true);
    if (TEMPLATE_INCLUDE_CONTENT_FOOTER == 'true') {
コード例 #2
0
$new_articles_query = tep_db_query("select a.articles_id, \r\n                                                a.articles_date_added, \r\n                                                ad.articles_name, \r\n                                                ad.articles_head_desc_tag, \r\n                                                au.authors_id, \r\n                                                au.authors_name, \r\n                                                td.topics_id, \r\n                                                td.topics_name \r\n                                                from " . TABLE_ARTICLES . " a, \r\n                                                " . TABLE_AUTHORS . " au, \r\n                                                " . TABLE_ARTICLES_DESCRIPTION . " ad, \r\n                                                " . TABLE_ARTICLES_TO_TOPICS . " a2t \r\n                                                left join " . TABLE_TOPICS_DESCRIPTION . " td on(a2t.topics_id = td.topics_id and td.language_id = '" . (int) $languages_id . "') \r\n                                                where a.articles_status = '1' \r\n                                                and (a.articles_date_available IS NULL or to_days(a.articles_date_available) <= to_days(now())) \r\n                                                and a.authors_id = au.authors_id \r\n                                                and a.articles_id = a2t.articles_id \r\n                                                and a.articles_id = ad.articles_id \r\n                                                and ad.language_id = '" . (int) $languages_id . "' \r\n                                                and a.articles_date_added > SUBDATE(now(), INTERVAL '" . NEW_ARTICLES_DAYS_DISPLAY . "' DAY) \r\n                                                order by a.articles_date_added desc, ad.articles_name");
$new_articles_check = tep_db_num_rows($new_articles_query);
if ($new_articles_check > 0) {
    include_once DIR_WS_LANGUAGES . $language . '/' . FILENAME_ARTICLES_NEW;
    $info_box_contents = array();
    $info_box_contents[] = array('text' => sprintf(TABLE_HEADING_NEW_ARTICLES, strftime('%B')));
    new contentBoxHeading($info_box_contents, tep_href_link(FILENAME_ARTICLES_NEW));
    $row = 0;
    $count = 0;
    $info_box_contents = array();
    while ($new_articles = tep_db_fetch_array($new_articles_query)) {
        $article_abstract = '';
        $article_author = '';
        $article_publish = '';
        if (DISPLAY_ABSTRACT_ARTICLE_LISTING == 'true') {
            $article_abstract = substr(cre_clean_html($new_articles['articles_head_desc_tag']), 0, MAX_ARTICLE_ABSTRACT_LENGTH) . '...<br>';
        }
        if (DISPLAY_AUTHOR_ARTICLE_LISTING == 'true') {
            $article_author = TEXT_BY . '<a href="' . tep_href_link(FILENAME_ARTICLES, 'authors_id=' . $new_articles['authors_id']) . '">' . $new_articles['authors_name'] . '</a><br>';
        }
        if (DISPLAY_DATE_ADDED_ARTICLE_LISTING == 'true') {
            $article_publish = TEXT_DATE_ADDED . $new_articles['articles_date_added'] . '<br>';
        }
        $info_box_contents[$row][0] = array('align' => 'left', 'params' => 'class="main" valign="top"', 'text' => '<a href="' . tep_href_link(FILENAME_ARTICLE_INFO, 'articles_id=' . $new_articles['articles_id']) . '"><span class="pro_list">' . $new_articles['articles_name'] . '</span></a><br>' . $article_author . $article_abstract . $article_publish);
        if ($new_articles['topics_id'] != '' && DISPLAY_TOPIC_ARTICLE_LISTING == 'true') {
            $info_box_contents[$row][1] = array('align' => 'left', 'params' => 'class="main" valign="top"', 'text' => TEXT_TOPIC . '<a href="' . tep_href_link(FILENAME_ARTICLES, 'tPath=' . $new_articles['topics_id']) . '">' . $new_articles['topics_name'] . '</a><br>');
        }
        $count++;
        $row++;
        if ($count == NEW_ARTICLES_HOMEPAGE_NUMBER_ITEMS) {
            break;
コード例 #3
0
 $cds_homepage_image = '';
 $row = 0;
 $info_box_contents = array();
 while ($cds_listing_result = tep_db_fetch_array($cds_listing_query)) {
     $cds_homepage_id = $cds_listing_result['pages_id'];
     if (defined('CDS_HOMEPAGE_SHOW_TITLE') && CDS_HOMEPAGE_SHOW_TITLE == 'true') {
         $cds_homepage_title = '<a href="' . tep_href_link(FILENAME_PAGES, 'pID=' . $cds_homepage_id . '&amp;CDpath=' . cre_get_cds_page_path($cds_homepage_id)) . '"><span class="cds_home_title">' . htmlspecialchars(cre_get_page_title($cds_homepage_id)) . '</span></a><br>';
     }
     if (defined('CDS_HOMEPAGE_SHOW_BLURB') && CDS_HOMEPAGE_SHOW_BLURB == 'true') {
         $cds_homepage_blurb = '<span class="cds_home_blurb">' . cre_clean_html(cre_get_page_blurb($cds_homepage_id)) . '</span><br>';
     }
     if (defined('CDS_HOMEPAGE_SHOW_THUMB') && CDS_HOMEPAGE_SHOW_THUMB == 'true') {
         $cds_homepage_image = '<a href="' . tep_href_link(FILENAME_PAGES, 'pID=' . $cds_homepage_id . '&amp;CDpath=' . cre_get_cds_page_path($cds_homepage_id)) . '">' . cre_get_page_thumbnail($cds_homepage_id) . '</a>';
     }
     if (defined('CDS_HOMEPAGE_SHOW_BODY') && CDS_HOMEPAGE_SHOW_BODY == 'true') {
         $txt_only = trim(cre_clean_html(cre_get_page_body($cds_homepage_id)));
         if (strlen($txt_only) <= CDS_HOMEPAGE_BODY_COUNT) {
             $txt_to_use = $txt_only;
         } else {
             if (substr($txt_only, CDS_HOMEPAGE_BODY_COUNT, 1) == ' ' || substr($txt_only, CDS_HOMEPAGE_BODY_COUNT, 1) == '.') {
                 // if the next character is a space, no agjustments needed
                 $txt_to_use = substr($txt_only, 0, CDS_HOMEPAGE_BODY_COUNT);
             } else {
                 $txt_short = substr($txt_only, 0, CDS_HOMEPAGE_BODY_COUNT);
                 // now back up to the last space
                 $pos = strrpos($txt_short, " ");
                 $txt_to_use = substr($txt_short, 0, $pos);
             }
         }
         $cds_homepage_body = '<span class="cds_home_body">' . $txt_to_use . ' <a href="' . tep_href_link(FILENAME_PAGES, 'pID=' . $cds_homepage_id . '&amp;CDpath=' . cre_get_cds_page_path($cds_homepage_id)) . '"><span class="cds_home_readmore">...Read More</span></a></span>';
     }