Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to display different result templates by channel model on dedecms search results page

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Editor to share with you how the dedecms search results page can display different result templates according to the channel model. I hope you will gain a lot after reading this article. Let's discuss it together.

How can the dedecms search results page display different result templates by channel model?

Dedecms has its own templates, such as picture model, article model, software model and so on. Sometimes it is necessary to add a decision to the search box for the sake of user experience, such as the template that displays the software model when searching for the software model and the template that displays the article model when searching for the article model.

The specific implementation code is as follows:

1. Join in the head area

The code is as follows:

Function check () {if (document.formsearch.channeltype.value== "1") document.formsearch.action= "{dede:field name='phpurl'/} / search.php" elsedocument.formsearch.action= "{dede:field name='phpurl'/} / search_news.php"}

two。 Change the search code

The code is as follows:

News software search

The point is that

The code is as follows:

News software

Key settings: search by model 1 is the article model 3 is the software model

3. Copy serach.php and change its name to search_images.php

4. Open search_images.php

Set

The code is as follows:

Require_once (DEDEINC. "/ arc.searchview.class.php"

Change to

The code is as follows:

Require_once (DEDEINC. "/ arc.searchimg.class.php"

5. Copy arc.searchview.class.php and change its name to arc.searchimg.class.php

6. Open arc.searchimg.class.php

Find

The code is as follows:

$tempfile = $GLOBALS ['cfg_basedir']. $GLOBALS [' cfg_templets_dir']. "/". $GLOBALS ['cfg_df_style']. "/ search.htm"

Change to

The code is as follows:

$tempfile = $GLOBALS ['cfg_basedir']. $GLOBALS [' cfg_templets_dir']. "/". $GLOBALS ['cfg_df_style']. "/ search_images.htm has finished reading this article. I believe you have some understanding of how the dedecms search results page can display different result templates according to the channel model. If you want to know more about it, welcome to follow the industry information channel. Thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report