搜外科技网站建设教程,网站制作新手教程,24小时学会网站建设

搜外科技网站系统主题开发安装教程: 400-859-1113
网站地图 xml
免费网站建设 > 主题开发 > 标签模块 > ⑫【模块调用】-相关标签及模块调用
⑫【模块调用】-相关标签及模块调用
2015-08-30 17:59:13

全局模块:全局模块中大部分标签是不能独立应用的,所以需要模块化嵌入或者删除。

<!--页面标题及Meta模块-->
<title><?php echo $meta['meta_title']; ?></title>
<meta name="description" content="<?php echo $meta['meta_description']; ?>" />
<meta name="keywords" content="<?php echo $meta['meta_keywords']; ?>" />
 

<!--导航模块-->
<div class="nav" id="ddtopmenubar"> 
<ul>
<?php foreach ($menu['channel_category'] as $key => $value) { ?>
<li <?php if ($value['channel_category_id']==$channel['channel_category_id']) echo "class='current'"; ?> ><a href="<?php echo $value['url'];?>" <?php if ($value['target']<>'') echo $value['target']; ?> <?php if(is_sub_categories($value['channel_category_id'])) echo " rel=\"ddsubmenu".$value['channel_category_id']."\""; ?>><?php echo $value['name'];?></a></li>
<?php } ?>
</ul>
</div>
 
<!--其中,频道页面(channel.php)的导航模块与其他页面的导航调用不一样--> 
<div class="nav" id="ddtopmenubar">
<ul>
<?php foreach ($menu['channel_category'] as $key => $value) { ?>
<li <?php if ($value['channel_category_id']==$channel['channel_category_id'] || $value['channel_category_id']==$channel_category_id) echo "class='current'"; ?>><a href="<?php echo $value['url'];?>" <?php if ($value['target']<>'') echo $value['target']; ?> <?php if(is_sub_categories($value['channel_category_id'])) echo " rel=\"ddsubmenu".$value['channel_category_id']."\""; ?>><?php echo $value['name'];?></a></li>
<?php } ?>
</ul>
</div>
 

<!--搜索模块-->
<div class="search"> 
<p><?php echo $lang['title_search'];?></p>
<div class="autocomplete">
<form name="searchform" id="searchform" action="<?php echo $conf['weburl'];?>/search.php" method="get">
<select name="category" id="sea_type">
<option value="0"><?php echo $lang['all_category'];?></option>
<?php foreach ($category as $key => $value) { ?>
<option value="<?php echo $value['category_id'];?>" <?php if ($value['category_id']==intval($_get['category'])) echo "selected"; ?>><?php echo $value['name'];?></option>
<?php } ?>
</select>
<input type="hidden" value="<?php echo $cur_val['language_id'];?>" name="language" id="language" />
<input type="text" class="searchinput" name="searchText" id="searchinput" value="<?php echo $_get['searchText'];?>" onfocus="searchformh.focuscheck.value='Y';" autocomplete="off" /> <div id="autocompletepanel" class="suggestList" style="display: none;"></div>
<input name="searchBtn" type="submit" value="<?php echo $lang['button_search'];?>" class="searchbt" />
</form> 
<form name="searchformh" id="searchformh" style="display:none">
<input type="hidden" name="focuscheck" value="N">
</form>
</div>
</div>


<!--品牌专区模块-->
<?php if($brand_list) { ?>
<div>
<p><?php echo $lang['brands_area'];?></p>
<ul>
<li>
<?php echo $brand_list; ?><!--品牌图片列表-->
</li>
</ul>
</div>
<?php } ?>


<!--热门标签模块-->
<?php if($tags_list) { ?>
<div>
<p><?php echo $lang['title_hot_tags'];?></p>
<ul>
<li>
<?php echo $tags_list; ?><!--热门标签列表-->
</li>
</ul>
</div>
<?php } ?>


<!--分类模块-->
<?php if ($is_sub) : ?><!--是否有栏目子类-->
<div class="sort">
<p><?php echo $left_sub_channel['name'];?></p>
<?php echo $channel_menu;?>
</div>
<div class="freeheight"></div>
<?php endif ; ?>
<div class="markermenu" id="ddtopmenubar1"><!--产品分类模块-->
<p><?php echo $lang['title_category'];?></p>
<?php echo $category_menu;?>
</div>


<!--第一个联系人一个或多个电话输出模块--> 
<?php foreach ($contact_tel_arr as $key => $value) { ?> 
<li class="tel"><p><?php if ($key==0){ echo $lang['tel'].":"; }?></p><span><?php echo trim($value);?></span></li>
<?php } ?>


<!--第一个联系人一个或多个邮箱输出模块--> 
<?php foreach ($contact_email_arr as $key => $value) { ?>
<li><p><?php if ($key==0){ echo $lang['email'].":"; }?></p><span><a href="mailto:<?php echo trim($value);?>"><?php echo trim($value);?></a></span></li>
<?php } ?>


<!--加入收藏模块-->
<a href="javascript:void(0);" target="_self" onclick="javascript:AddFavorite('<?php echo $conf['weburl'];?>','<?php echo $company_desc['company_name'];?>')" rel="nofollow" ><?php echo $lang['add_favoriter'];?></a>

<!--备案输出模块(后台网站配置中的备案)-->
<?php if ( $conf['beian'] ) : ?><a href="http://www.miibeian.gov.cn" target="_blank" rel="nofollow"><?php echo $conf['beian']; ?></a><?php endif ; ?> 

<!--判断语言版本模块-->
<?php if ($directory=='cn') : ?><!--判断是否为cn文件夹,即判断是否为中文版-->
<?php if ($cur_val['default_value']==1) : ?><!--判断是否为首页-->
... 
<?php else : ?>
... 
<?php endif ; ?>
<?php else : ?>
...
<?php endif ; ?>


<!--语言版本模块-->
<?php if (count($language_arr)>1) : ?>
<dl>
<dd>
<?php foreach ($language_arr as $key => $value) { ?>
<a href="<?php echo $value['url'];?>" <?php if ($cur_val['language_id']==$value['language_id']){ ?> class="current" <? } ?>><?php echo $value['name'];?></a>
<?php } ?>
</dd>
</dl>
<?php endif ; ?>


首页局部模块调用:

<!--广告模块-->
<div class="ban">
<script type="text/javascript" src="<?php echo $conf['weburl'];?>/vcall.php?language=<?php echo $cur_val['language_id'];?>&amp;flag=banner"></script>
</div>


<!--首页新闻模块-->
1.第一种情况:新闻没有添加图片时不显示图片新闻这一条 
<div class="home_news">
<?php 
$category_id = 4; //这里填写需要调用的栏目ID
$news_num = 4; //这里填写调用文章列表的条数
$news_img_num = 1; //这里填写调用图片类表的条数 
$news = call_channel($cur_val['language_id'],$category_id,$news_num,$news_img_num);
$info = get_category_related_info($cur_val['language_id'],$category_id);
?>
<div class="title"><p><?php echo $info['name'];?></p><span><a href="<?php echo $info['url'];?>"><?php echo $lang['more'];?></a></span></div>
<?php foreach ($news["newsimg"] as $key => $value) { ?>
<div class="newsimage">
<?php if ($value['small_img']) { ?>
<a href="<?php echo $value['url'];?>"><img src="<?php echo $value['small_img'];?>" alt="<?php echo $value['name'];?>" /></a>
<p><a href="<?php echo $value['url'];?>"><?php echo qt_news_title($value['return_name'],35);?></a><?php echo csubstr($value['abstract'],100);?></p>
<?php } ?>
</div>
<?php } ?>
<ul>
<?php foreach ($news["newslist"] as $key => $value) { ?>
<li><?php echo $value['pubdate2'];?><a href="<?php echo $value['url'];?>" title="<?php echo $value['name'];?>"><?php echo $value['return_name'];?></a></li>
<?php } ?>
</ul>
</div>

2.第二种情况:新闻没有添加图片时用默认的新闻图片替代 
<div class="home_news">
<?php 
$category_id = 4; //这里填写需要调用的栏目ID
$news_num = 4; //这里填写调用文章列表的条数
$news_img_num = 1; //这里填写调用图片类表的条数 
$news = call_channel($cur_val['language_id'],$category_id,$news_num,$news_img_num);
$info = get_category_related_info($cur_val['language_id'],$category_id);
?>
<div class="title"><p><?php echo $info['name'];?></p><span><a href="<?php echo $info['url'];?>"><?php echo $lang['more'];?></a></span></div>
<?php if ($news['newsimg']) { ?>
<div class="newsimage">
<?php foreach ($news["newsimg"] as $key => $value) { ?>
<?php if ($value['small_img']) { ?>
<a href="<?php echo $value['url'];?>"><img src="<?php echo $value['small_img'];?>" alt="<?php echo $value['name'];?>" /></a><p><a href="<?php echo $value['url'];?>"><?php echo qt_news_title($value['return_name'],35);?></a>
<?php echo csubstr($value['abstract'],70);?></p>
<?php } ?>
<?php } ?>
</div>
<?php }else{ ?>
<div class="newsimage">
<?php foreach ($news["newslist"] as $key => $value) { ?><?php } ?>
<a href="<?php echo $info['url'];?>"><img src="<?php echo $conf['weburl'];?>/skin/<?php echo $skin;?>/<?php echo $directory;?>/images/newsimg.gif" alt="<?php echo $info['name'];?>" /></a>
<p><a href="<?php echo $value['url'];?>"><?php echo qt_news_title($value['return_name'],35);?></a><?php echo csubstr($value['abstract'],70);?></p>
</div>
<?php } ?>
<ul>
<?php foreach ($news["newslist"] as $key => $value) { ?>
<li><a href="<?php echo $value['url'];?>" title="<?php echo $value['name'];?>"><?php echo qt_news_title($value['return_name'],49);?></a></li>
<?php } ?>
</ul>
</div>

<!--图片列表栏目内容调用-->
<?php 
$category_id = 12; //这里填写需要调用的图片列表栏目的ID
$news_num = 0; 
$news_img_num = 10; //这里填写调用图片类表的条数 
$news = call_channel($cur_val['language_id'],$category_id,$news_num,$news_img_num);
$info = get_category_related_info($cur_val['language_id'],$category_id);
?>
<?php foreach ($news["newsimg"] as $key => $value) { ?>
<?php if ($value['small_img']) { ?>
<li><p><a href="<?php echo $value['url'];?>" title="<?php echo $value['return_name'];?>"><img src="<?php echo $value['small_img'];?>" alt="<?php echo $value['return_name'];?>" /></a></p><span><a href="<?php echo $value['url'];?>" title="<?php echo $value['return_name'];?>"><?php echo $value['return_name'];?></a></span></li>
<?php } ?>
<?php } ?>


<!--单页栏目内容调用-->
<?php 
$category_id = 11; //这里填写需要调用的单页的栏目ID
$news_num = 0;
$news_img_num = 0;
$news = call_channel($cur_val['language_id'],$category_id,$news_num,$news_img_num);
$info = get_category_related_info($cur_val['language_id'],$category_id);
?>
<?php echo $news['abstract'];?>


<!--首页公司介绍模块-->
<div class="home_about">
<div class="title"><p><?php echo $lang['title_aboutus'];?></p><span><a href="<?php echo $menu['aboutus_url'];?>"><?php echo $lang['more'];?></a></span></div>
<div class="about"><?php echo $aboutus;?></div>
</div> 


<!--首页推荐产品模块-->
<?php if ($featured_product) : ?>
<div class="home_products">
<div class="title"><p><?php echo $lang['title_featured_products'];?></p><span></span></div>
<div class="home_ppics">
<ul>
<?php foreach ($featured_product as $key => $value) { ?>
<li>
<p><a href="<?php echo $value['product_url'];?>" target="_blank"><img src="<?php echo $value['image_url'];?>" alt="<?php echo $value['name'];?>" border="0" /></a></p>
<span><a href="<?php echo $value['product_url'];?>" title="<?php echo $value['name'];?>" target="_blank"><?php echo $value['cutname'];?></a></span>
</li>
<?php } ?>
</ul>
<div class="clear"></div>
</div>
</div> 
<?php endif ; ?>


<!--首页最新产品模块-->
<?php if ($new_product) : ?>
<div class="home_products">
<div class="title"><p><?php echo $lang['title_new_products'];?></p><span></span></div>
<div class="home_ppics">
<ul>
<?php foreach ($new_product as $key => $value) { ?>
<li><p><a href="<?php echo $value['product_url'];?>" target="_blank"><img src="<?php echo $value['image_url'];?>" alt="<?php echo $value['name'];?>" border="0" /></a></p>
<span><a href="<?php echo $value['product_url'];?>" title="<?php echo $value['name'];?>" target="_blank"><?php echo $value['cutname'];?></a></span></li>
<?php } ?>
</ul>
<div class="clear"></div>
</div>
</div>
<?php endif ; ?>


<!--友情链接模块-->
<div class="links">
<p><?php echo $lang['title_link'];?>:</p>
<?php if ($link_logo || $link_text){ ?>
<?php if ($link_logo) : ?>
<ul>
<?php foreach ($link_logo as $key => $value) { ?>
<li><a href="<?php echo $value['link_url'];?>" target="_blank"><?php echo $value
['link_logo'];?></a></li> 
<?php } ?>
</ul>
<?php endif ; ?>
<?php if ($link_text) : ?>
<?php foreach ($link_text as $key => $value) { ?>
<a href="<?php echo $value['link_url'];?>" target="_blank"><?php echo $value
['link_name'];?></a> 
<?php } ?>
<?php endif ; ?>
<a href="links.html"><?php echo $lang['link_more'];?></a>
<?php } ?>
</div>




  [返回首页] [打印] [返回上页]   下一篇

我要评论

  • *姓名:

  • *邮箱:

  • *内容:

  • *等级:

产品分类

    联系方式

    点击这里给我发消息
    点击这里给我发消息