."/> .">

Home  >  Article  >  CMS Tutorial  >  How to set up the dynamic code for custom pages in Empire CMS

How to set up the dynamic code for custom pages in Empire CMS

下次还敢
下次还敢Original
2024-04-16 21:39:13719browse

Steps to obtain dynamic code for Empire CMS custom page: Create a custom page and switch to HTML editing mode. Copy and paste the code, replacing the table name and sort field. Save the page and get the page address. Call the code at the desired location: .

How to set up the dynamic code for custom pages in Empire CMS

How to set up dynamic code for Empire CMS custom page

Step 1: Create a custom page

  • Log in to the Empire CMS backend.
  • Click "Page Management" → "Add Page" in the left menu bar.
  • Enter the page name and alias.

Step 2: Set up dynamic code

  • In the page content editor, switch to "HTML" mode.
  • Copy and paste the following code into the editor:
<code class="html"><?php 
$sql = "SELECT * FROM `表名` ORDER BY `排序字段` ASC"; 
$rs = $empire->query($sql); 
while($r = $empire->fetch($rs)) {
?> 

<!-- 输出动态内容 -->
<p>标题:<?php echo $r['title']; ?></p>
<p>内容:<?php echo $r['content']; ?></p>

<?php 
} 
?> </code>
  • Replace "table name" with the name of the table from which the data needs to be read.
  • Replace "sort field" with the sort field, usually "id" or "sort".

Step 3: Save the page

  • Click the Save button at the top of the page editor.

Step 4: Get the page address

  • Find the created custom page in "Page Management".
  • Copy its "page address".

Step 5: Call the custom page

  • Where dynamic content needs to be displayed, call the following code:
<code class="html"><iframe src="自定义页面地址" width="100%" height="1000"></iframe></code>
  • Replace "custom page address" with the page address copied in step 4.

The above is the detailed content of How to set up the dynamic code for custom pages in Empire CMS. 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