search
HomeBackend DevelopmentPHP TutorialPHPCMS V9 adds secondary navigation
PHPCMS V9 adds secondary navigationOct 20, 2016 am 11:40 AM
phpcms

I looked at phpcms today and found a problem when writing the secondary navigation. When querying the navigation bar information, the $r[arrchildid] returned was not consistent with what I imagined. The document said that the sub-column id was returned, but it was somewhat different.

Starting idea:

    首页       {pc:content action="category" catid="0" num="10" siteid="$siteid" order="listorder ASC"}
          {loop $data $r}
          {if $r[arrchildid]}
                          {$r[catname]}                                   {pc:content action="category" catid="$r[catid]" num="10" siteid="$siteid" order="listorder ASC" return="data2"}
                    {loop $data2 $v}
                      {$v[catname]}                    {/loop}
                  {/pc}
                   
                      {/if}
        {/loop}
     {/pc}

General idea: Check whether there is a sub-column ID under the document, and if so, output the secondary navigation. Line 5 of the code is to detect whether there is a sub-column ID under the column, but I found that when there is no sub-column, the ID of the current column will be returned, causing the judgment to fail to achieve the expected effect, so I changed my mind and the code is as follows:

    首页      {pc:content action="category" catid="0" num="10" siteid="$siteid" order="listorder ASC"}
         {loop $data $r}
           {if $r[arrchildid] != $r[catid]}
                            {$r[catname]}                                     {pc:content action="category" catid="$r[catid]" num="10" siteid="$siteid" order="listorder ASC" return="data2"}
                      {loop $data2 $v}
                        {$v[catname]}                      {/loop}
                     {/pc}
                    
                         {else}
              {$r[catname]}           {/if}
        {/loop}
      {/pc}

Judgement acquisition Whether the sub-column id is equal to the column id, if equal, it means there is no sub-column, if not equal, it means there is a sub-column and the sub-column is displayed

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
phpcms是什么框架phpcms是什么框架Apr 20, 2024 pm 10:51 PM

PHP CMS 是一种基于 PHP 的开源内容管理系统,用于管理网站内容,其特点包括易用性、强大功能、可扩展性、安全性高和免费开源。它可以节省时间、提升网站质量、增强协作并降低开发成本,广泛应用于新闻网站、博客、企业网站、电子商务网站和社区论坛等各种网站。

phpcms怎么跳转到详情页phpcms怎么跳转到详情页Jul 27, 2023 pm 05:23 PM

phpcms跳转到详情页方法:1、使用header函数来生成跳转链接;2、循环遍历内容列表;3、获取内容的标题和详情页链接;4、生成跳转链接即可。

微信登录集成指南:PHPCMS实战微信登录集成指南:PHPCMS实战Mar 29, 2024 am 09:18 AM

标题:微信登录集成指南:PHPCMS实战在今天的互联网时代,社交化登录已经成为网站必备的功能之一。微信作为国内最流行的社交平台之一,其登录功能也被越来越多的网站所采用。本文将介绍如何在PHPCMS网站中集成微信登录功能,并提供具体的代码示例。第一步:注册微信开放平台账号首先,我们需要在微信开放平台上注册一个开发者账号,申请相应的开发权限。登录[微信开放平台]

phpcms是什么意思phpcms是什么意思Apr 20, 2024 pm 10:39 PM

PHPCMS 是一款免费开源的内容管理系统 (CMS),特点包括:开放源码、模块化、灵活、用户友好和社区支持。它可用于创建各种类型的网站,包括企业网站、电子商务网站、博客和社区论坛。技术要求包括:PHP 5.6 或更高版本、MySQL、MariaDB 或 PostgreSQL 数据库以及 Apache 或 Nginx Web 服务器。

phpcms不是免费吗phpcms不是免费吗Mar 01, 2023 am 10:24 AM

phpcms不是完全免费的。phpcms属于开源cms系统,但是开源并不等于免费,它有两个版本:免费版和商业版,免费版仅限于个人非商业用途,而商业版需要购买授权;个人可以作为研究使用,如果商业应用,需要支付一定费用。

phpcms用什么数据库phpcms用什么数据库Feb 21, 2023 pm 06:57 PM

phpcms用mysql数据库。phpcms是一个PHP开源网站管理系统,采用PHP+MYSQL做为技术基础进行开发。PHPCMS V9采用OOP方式进行基础运行框架搭建,支持的PHP版本是PHP5及以上、支持的MYSQL版本是MySql 4.1以上版本。

2023年最新phpcms视频教程推荐(二次开发必学)2023年最新phpcms视频教程推荐(二次开发必学)Oct 25, 2019 pm 03:45 PM

很多站长使用PHPCMS进行二次开发建站,PHP中文网特意推出了phpcms视频教程,大家可以随时随地免费观看视频教程,不需要从百度网盘下载,非常方便。

phpcms有哪些版本phpcms有哪些版本Jun 14, 2023 pm 01:13 PM

phpcms有两个版本比较知名,分别是:1、phpCMS4,支持自定义 URL 规则,网站管理后台美观易用,前端插件许多,可自由扩展功能;2、phpCMS2008R1,支持多语言、多站点管理,页面管理器便捷灵活方便,非常轻量级,运行速度快。

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.