search
HomeCMS TutorialPHPCMSHow to call content in phpcms
How to call content in phpcmsJan 08, 2020 am 10:39 AM
phpcms

How to call content in phpcms

How to call content in phpcms?

How to call the content of a single article on the home page of phpcms

In fact, there are many solutions to using phpcms to call the content of a single article on the home page list page. We can copy the content directly instead of using the program to automatically call it. However, if there are many repeated operations, there will be certain cumbersome locks. In addition, we can list the tag {pc:content} to implement automatic calling.

Two implementation methods introduced to you.

Analysis of ideas for calling internal page article content on the home page

Reminder: Starting from PHPCMS V9 Beta 20101105 version, the moreinfo parameter attribute is supported. This parameter indicates that when returning data, The data in the secondary table will also be returned together. A content model is divided into two tables, a main table and a sub-table. The main table generally stores short data such as titles and columns (convenient for indexing), while the sub-table stores data in large fields. Data such as content. When you create a new field in model management, you are allowed to choose whether to store it in the main table or the secondary table (we recommend putting unimportant information in the secondary table).

If you want to retrieve the data of the secondary table in the list, you need to use the moreinfo attribute in the PC tag. But we only call a fixed article on the homepage instead of using it in large quantities, which is still acceptable for performance. Here are two ways to do this.

Method to implement the content of a single article

Method 1:

Use {pc:content action="lists"} basic tags to implement a list, each List items are all called content. If you only want to call the content of a certain article, change num="4" to num="1". The called article is the first or last article, and pass order="id DESC or order="id" To adjust.

<div>
{pc:content  action="lists" catid="6" order="id DESC" num="4" moreinfo="1"}
    <ul>
    {loop $data $key $val}
        <li>
            <a href="{$val[&#39;url&#39;]}">{$val[&#39;title&#39;]}</a>
            <div>
                {$val[&#39;content&#39;]}
            </div>
        </li>
    {/loop}
    </ul>
{/pc} 
</div>

Method 2:

Use the extended {pc:content action="lists"} tag to call the internal page article content of the specified article ID. You need to use the where attribute to Specify the article ID value to be called. This implementation method is more flexible, but slightly more complicated than the first one.

<div>
{pc:content  action="lists" catid="6" where="`id`=3" num="1" moreinfo="1"}
    <ul>
    {loop $data $key $val}
        <li>
            <a href="{$val[&#39;url&#39;]}">{$val[&#39;title&#39;]}</a>
            <div>
                {$val[&#39;content&#39;]}
            </div>
        </li>
    {/loop}
    </ul>
{/pc} 
</div>

PHP Chinese website, a large number of free PHPCMS tutorials, welcome Online Learning!

The above is the detailed content of How to call content in phpcms. For more information, please follow other related articles on the PHP Chinese website!

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网站中集成微信登录功能,并提供具体的代码示例。第一步:注册微信开放平台账号首先,我们需要在微信开放平台上注册一个开发者账号,申请相应的开发权限。登录[微信开放平台]

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

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

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

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

phpcms有评论功能吗phpcms有评论功能吗Feb 16, 2023 am 10:06 AM

phpcms有评论功能。phpcms内置评论模块,提供了让网站的浏览者发布自己见解的功能,使得浏览者可以互动,相互交流自己的看法,来增加网站人气。PHPCMS的评论用户留言的功能,同时还增加了审核功能,防止言论中出现违禁词汇等。对网站管理者而言,PHPCMS的评论模块可以方便的管理用户评论,可以根据时间、关键字、是否审核等条件查找并管理留言内容。

phpcms怎么实现微信登陆phpcms怎么实现微信登陆Mar 09, 2023 am 09:33 AM

phpcms实现微信登录的方法:1、在根目录新建“wechat.php”;2、在“\phpcms\modules\member\index.php”下增加“public function wechat() {...}”;3、在“foreground.class.php”文件中通过wechat函数判断用户是否登录即可。

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

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

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)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!