首页 > 代码库 > advancedsearch.php织梦高级自定义模型字段无法调用解决方案

advancedsearch.php织梦高级自定义模型字段无法调用解决方案

advancedsearch.php织梦dedecms 高级自定义模型字段无法调用解决方案 ,具体步骤如下:

1  打开修改puls/advancedsearch.php文件,找到复制代码(不同版本可能有所差别)。
 
 
$query = "SELECT addon.*, arctype.* FROM $addontable addon   
        LEFT JOIN arctype ON arctype.id = addon.typeid  
        $where $orderby";   
    } else {   
        $query = "SELECT main.id AS aid,main.*,main.description AS description1, type.* 
    FROM $maintable main   
    LEFT JOIN type ON type.id = main.typeid   
    LEFT JOIN $addontable addon ON addon.aid = main.id   
    $where  $orderby";  
 
 
如果是5.7以前的版本
$query = "SELECT addon.*, arctype.* FROM $addontable addon  
这一段是没有 addon 的!
复制这段加上即可!
 
2 然后 再改这段
 
else {   
       $query = "SELECT main.id AS aid,main.*,main.description AS description1, type.* 
   FROM $maintable main   
   LEFT JOIN type ON type.id = main.typeid   
   LEFT JOIN $addontable addon ON addon.aid = main.id   
   $where  $orderby";  
 
5.7所有的版本 都要改这段 改成:
else {   
  $query = "select addon.*,main.id as aid,main.*,main.description as description1, type.*
from $maintable main  
left join dede_arctype type on type.id=main.typeid  
left join $addontable addon on addon.aid=main.id  
$where  $orderby";  
就是
       $query = "SELECT main.id AS aid,main.*,main.description AS description1, type.* 
 
这段改成
  $query = "select addon.*,main.id as aid,main.*,main.description as description1, type.*
这样即可! 
所以所有版本改后的代码为:
$query = "select addon.*, arctype.* from $addontable addon  
  left join dede_arctype arctype on arctype.id=addon.typeid  
  $where $orderby";   
} else {   
  $query = "select addon.*,main.id as aid,main.*,main.description as description1, type.*
from $maintable main  
left join dede_arctype type on type.id=main.typeid  
left join $addontable addon on addon.aid=main.id  
$where  $orderby";  

advancedsearch.php织梦高级自定义模型字段无法调用解决方案