74cms分站职位发布只能在一个分站显示

1.首先在这几张表里面把subsite_id这个字段改成char类型,长度100。
74cms分站职位发布只能在一个分站显示 - 永不放弃 - 原创php教程|php博客|php乐园

2.修改企业发布职位,找到user/company下company_jobs.php这个文件中72和403行下分别添加$smarty->assign('subsite',get_subsite_all()),找到$setsqlarr['subsite_id']=intval($_CFG['subsite_id'])这行替换成

 $subsite_id=!empty($_POST['subsite_id'])?$_POST['subsite_id']:array();
 $subsite_id=!empty($subsite_id)?implode(',',$subsite_id):0;

3.在include下找到common.fun.php这个文件,在文件中添加函数

function get_subsite_all()
{
 global $db;
 $sql = "select * from ".table('subsite');
 return $db->getall($sql);
}

4.在/templates/default/member_company/找到company_addjobs.htm这个模板中添加

 <tr>
      <td height="23" align="right">职位发布到:</td>
      <td>{#if $QISHI.subsite_id=="0"#}{#/if#}
         <!-- <label><input name="subsite_id" type="radio" value="0" checked />全站</label>
    &nbsp;&nbsp;-->
    {#foreach from=$subsite item=li#}
    <label ><input name="subsite_id[]" type="checkbox" value="{#$li.s_id#}" />{#$li.s_districtname#}</label>
    &nbsp;&nbsp;&nbsp;
    {#/foreach#}
    
     </td>
      </tr>
    {#/if#}

在company_editjobs.htm这个模板中添加

 {#if $QISHI.subsite=="1"#}
  <tr>
      <td height="23" align="right"><strong  style="color:#FF0000">*</strong>职位发布到:</td>
      <td><!--{#if $QISHI.subsite_id=="0"#}{#/if#}
          <label><input name="subsite_id" type="radio" value="0"  {#if $jobs.subsite_id=="0"#}checked="checked"{#/if#}/>全站</label>
    &nbsp;&nbsp;-->
    {#foreach from=$subsite item=li#}
    <label ><input name="subsite_id[]" type="checkbox" value="{#$li.s_id#}" {#if strstr($jobs.subsite_id,$li.s_id) #}checked="checked"{#/if#} />{#$li.s_districtname#}</label>
    &nbsp;&nbsp;&nbsp;
    {#/foreach#}
    
     </td>
      </tr>
    {#/if#}

5.找到/include/template_lite/plugins/这个目录下function.qishi_jobs_list.php和function.qishi_company_list.php这个文件中找到

$wheresql.=" AND (subsite_id=0 OR subsite_id in (".intval($_CFG['subsite_id'])."))";这个替换成

$wheresql.=" AND (subsite_id=0 OR FIND_IN_SET(".intval($_CFG['subsite_id']).",subsite_id))";

6.完成代码改动就可以试试调用了。

 

你可能感兴趣的:(74cms,职位全站发布,职位只能分站显示)