Custom PHP Pages

Custom PHP Pages 1.2.2

没有下载权限
XF 兼容性
  1. 2.3.x
  2. 2.2.x
摘要
Create custom PHP pages with or without XF layout using this add-on. Access XF engine functions like sessions and permissions. Customize head tags, titles, content, and more per page for enhanced user experience. No restrictions on script location; flexible configuration options available.
This add-on allows creating any number of custom PHP pages with or without the XF layout.
A custom page has access to the XF engine's functions, including sessions and permissions.

All custom pages are their own PHP script with individual configuration; PHP knowledge is required.
A custom page script can be above, below or within the XF install folder, no restrictions.

You can optionally configure any of the following items on a per-page basis:

The custom <head> tag items on top of XenForo's defaults (presumably from an external script)
The custom page title
The custom page content
Whether or not to wrap above content in the XenForo layout
Whether or not to include XF's social meta tags for social media content previews
Whether or not to show breadcrumbs, and what breadcrumbs to show

Installation Instructions

Install the add-on zip file (this is an add-on package without extra files)
Make a copy of sample.php script and name it whatever you want
Point the script's XF constant value to your XenForo install folder; the default is DIR
Set the $head and/or $content variables
Adjust the \ScriptsPages\Setup::set parameters (below), and installation is complete

Sample (sample.php)
PHP:
<?php
// Set PHP Reporting
error_reporting(E_ALL & ~E_NOTICE);
define('__XF__', __DIR__); // EDIT VALUE IF SCRIPT IS NOT IN XF FOLDER
require __XF__ . '/src/XF.php';
XF::start(__XF__);
\ScriptsPages\Setup::set('init', true);
$app = \XF::setupApp('XF\Pub\App');
$app->start();
$request = $app->request();
// EDIT BELOW to set the page's $head and/or $content; the code below is a sample
/** ob_start();
require_once __DIR__ . DIRECTORY_SEPARATOR . pathinfo(__FILE__, PATHINFO_FILENAME) . "-head.php";
$head = ob_get_contents();
ob_end_clean(); **/
/** ob_start();
require_once __DIR__ . DIRECTORY_SEPARATOR . pathinfo(__FILE__, PATHINFO_FILENAME) . "-content.php";
$content = ob_get_contents();
ob_end_clean();  */
// EDIT BELOW TO CONFIGURE
\ScriptsPages\Setup::set([
    'breadcrumbs' => ['Item 1' => '/1', 'Item 2' => '/2', 'Item 3' => '/3'],
    'head' => $head,
    'content' => $content
]);
// STOP HERE
$app->run()->send($request);

Parameters
PHP:
[
    'navigation_id' => null, // the navigation tab to highlight
    'head' => null, // code to embed inside the <head> tag
    'metadata' => true, // include social media meta tags like 'og:*' for social media previews
    'title' => null, // the page title; if null, falls back to board title
    'breadcrumbs' => true, // true to include breadcrumbs, false to not, or an array of [name => href, ...]
    'content' => null, // the page content; this is required
    'raw' => false // whether or not to remove the XenForo layout
]
How to set parameters externally

To set any parameter above from an external script, define the PHP constant SCRIPT_PAGE_{KEY} prior to loading XenForo, i.e.
代码:
define('SCRIPT_PAGE_CONTENT', '<b>Hello world</b>');
作者
axtona
浏览
358
扩展类型
zip
文件大小
23.5 KB
首次发布
上次更新
评分 0.00 星 0 个评分
链接失效了吗? 发送消息 给 NP 团队,我们会尽快为您处理!
支持开发者 如果您对测试满意或项目已成功盈利,可点击「更多信息」按钮,通过购买来支持开发者!

最新更新

  1. 1.2.2 - changelog
    Fixed major bug causing custom breadcrumb and title parameters to be ignored. Changed minimum...
  2. 1.2.1 - changelog
    Fixed InvalidArgumentException error.
  3. 1.1.5 - changelog
    Fixed bug that was preventing XF 2.3 compatibility.

来自 axtona 的更多资源

StackFood 多餐厅 - 使用 Laravel 的食物配送应用以及餐厅面板 A
一个使用Laravel和Flutter框架开发的多餐厅食物配送系统。
 滾動按鈕 A
滚动按钮是一款强大的界面增强插件,编码采用了现代网页趋势
Shack Open Graph Pro A
这个扩展程序为您的网站添加了Open Graph和Twitter卡标签
浏览
450
已更新

相似的资源

[AndyB] Custom search A
Search posts using multiple criteria.
浏览
438
已更新
[AndyB] Custom title manager A
Allows viewing and managing custom user titles.
浏览
376
已更新
可搜索的自定义页面 A
这个插件允许你通过使用自定义数据库表来使自定义页面可搜索
浏览
216
已更新
顶部