Pursuing a dream search page calls the custom field method

Under normal circumstances, the search page can not be called custom fields, said the following, the search page how to call a custom field:
First, open the include / extend.func.php this file, add the following code at the end of the file

function Search_addfields($id,$result){
global $dsql;
$mnkj = $dsql->GetOne("SELECT * FROM `dede_addonarticle` where aid='$id'");
$name=$mnkj[$result];
return $name;
 } 

Addonarticle which is to call the custom fields attached tables, in weaving dreams background core -> channel model -> Content management model can be seen, the article is generally addonarticle ordinary, but for example, you added a new model in the content model, where additional models will change your table, this needs to change depending on the situation, the other without modification.
Then open include / arc.searchview.class.php this file, search for "// handle some special fields", add the following code below:

 `$row["ceshi"]=Search_addfields($row["id"],"ceshi");` 

Ceshi which is a custom field names, if there are multiple custom fields that add multiple lines, but must take the next ceshi modification. After adding completed the final step in the search template is also called, in search.htm the [field: ceshi /] can be called out, which ceshi custom fields.

Published 10 original articles · won praise 0 · Views 101

Guess you like

Origin blog.csdn.net/lichuang214/article/details/104782113