Discuz is a popular forum program that can make the forum more personalized by modifying the navigation bar. However, many webmasters will encounter some common problems when modifying the Discuz navigation bar. This article will introduce ten common problems and provide specific code sample solutions.
The navigation bar link cannot be displayed: First, make sure that the navigation bar link is correctly set in the background management. Then add the following code in the header.htm of the forum template:
<!--{eval $mnid=0;}--> <ul class="p_pop h_pop" id="mn_userapp_menu" style="display: none;"> <!--{loop $_G['setting']['my_app'] $nav}--> <!--{if $nav['show']}--> <!--{if $nav['type'] == 'userapp'}--> <!--{if $nav['menutype']}--> <li><a href="userapp.php?mod={$nav[module]}" id="mn_userapp_{$nav[module]}" hidefocus="true" onfocus="showMenu({'ctrlid':'mn_userapp_{$nav[module]}'})"><img src="{$nav[icon]}" alt="" />{$nav[appname]}</a></li> <!--{else}--> <li><a href="userapp.php?mod={$nav[module]}" hidefocus="true" onfocus="showMenu({'ctrlid':'mn_userapp_{$nav[module]}'})">{$nav[appname]}</a></li> <!--{/if}--> <!--{else}--> <li><a href="{$nav[url]}" hidefocus="true">{$nav[text]}</a></li> <!--{/if}--> <!--{eval $mnid++;}--> <!--{/if}--> <!--{/loop}--> </ul>
Navigation bar text color modification: Add the following code in the CSS file to modify the navigation bar text color :
#hd ul li a { color: #FF0000; }
Add a new link to the navigation bar: Add the following code to header.htm to add a new link:
<a href="http://www.example.com" target="_blank">新链接</a>
The navigation bar submenu is not displayed properly: Add the following code in the CSS file to adjust the navigation bar submenu style:
#mn_userapp_menu { position: absolute; top: 30px; left: 0px; z-index: 99; }
Navigation bar icon Replace : Replace the corresponding icon file and modify the corresponding code in header.htm:
<li><a href="example.html"><img src="newicon.png" alt="">链接文字</a></li>
Navigation bar background color modification: In the CSS file Add the following code to modify the background color of the navigation bar:
#hd { background-color: #FFFF00; }
Change the horizontal arrangement of the navigation bar to vertical arrangement: Modify the layout code in header.htm to vertical arrangement:
<ul class="p_pop h_pop" id="mn_userapp_menu" style="max-width:90%"> ... </ul>
Navigation bar default selected state setting: Add the following code in header.htm to set the default selected state:
<a href="example.html" class="current">默认选中链接</a>
Navigation bar font size modification: Add the following code to the CSS file to modify the navigation bar font size:
#hd ul li a { font-size: 16px; }
Navigation bar mobile display adaptation : Add the following code to ensure that the navigation bar displays normally on the mobile terminal:
@media screen and (max-width: 768px) { #hd { display: none; } }
Through the above specific code examples, webmasters can easily solve common problems in the process of modifying the Discuz navigation bar. Questions to make the forum more suitable to your needs and style. I hope this article will be helpful to webmasters.
The above is the detailed content of Top 10 Discuz Navigation Bar Modification FAQs. For more information, please follow other related articles on the PHP Chinese website!