Theme editor

[vbresults.com] Custom PHP Pages

[vbresults.com] Custom PHP Pages

[vbresults.com] Custom PHP Pages 1.2.2

XF 2.3 Addons · by Staraddons
0 Downloads 5 Views 0 Version
This add-on allows creating any number of custom PHP pages with or without the XF layout
Price
Free
There are no downloadable versions available for this resource yet.

Overview Version (0) Discussion (1) License

  • [vbresults.com] Custom PHP Pages
    [vbresults.com] Custom PHP Pages
    This add-on allows creating any number of custom PHP pages with or without the XF layout
    About this resource
    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
    1. Under Admin > Add-ons > Install/upgrade from archive, import/install the attached add-on zip
    2. Make a copy of sample.php script and name it whatever you want
    3. Point the script's XF constant value to your XenForo install folder; the default is DIR
    4. Set the $head and/or $content variables
    5. Adjust the \ScriptsPages\Setup::set parameters (below), and installation is complete
    Sample.php
    PHP:
    Expand Collapse Copy
    <?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';
    
    $_SERVER['SCRIPT_NAME'] = __XF__ . '/index.php';
    $_SERVER['REQUEST_URI'] = preg_replace("|^" . preg_quote(preg_replace('|(/+)$|', '', $_SERVER['DOCUMENT_ROOT'])) . "|", '', __XF__ . '/index.php');
    
    XF::start(__XF__);
    
    $app = \XF::setupApp('XF\Pub\App');
    // $app->start(); // comment out for 2.3+
    $request = $app->request();
    
    \ScriptsPages\Setup::set('init', true);
    
    // 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:
    Expand Collapse Copy
    [
        '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
    ]
    To set any parameter above from an external script, define the PHP constant SCRIPT_PAGE_{KEY} prior to loading XenForo, i.e.

    PHP:
    Expand Collapse Copy
    define('SCRIPT_PAGE_CONTENT', '<b>Hello world</b>');
  • Version
    There are no downloadable versions available for this resource yet.
  • Discussion

    This resource has a discussion thread on the forum where you can ask questions, report issues, and talk with the author and other users.

    Join the discussion (1)

  • License Terms

    By purchasing this resource, you are granted a license to use it on one (1) site, for as long as your license remains valid. You are not purchasing ownership of the underlying code.

    How your license works
    • Your license is checked automatically in the background. This never affects your site's visitors.
    • As long as your license is valid, this resource keeps working normally — even if our license server is briefly unreachable, a temporary network issue will never disable it.
    • Your license is bound to your site's domain the first time it's used.

    Moving to a new domain?
    Contact us and we'll move your license for you.

    What's included
    Updates and support for the period stated on this resource's page (see the Version tab for the current release).

    What's not allowed
    • Sharing your license with others, or using it on more than one site at a time
    • Removing or bypassing the license check in the code
Resource information
Category XF 2.3 Addons
Author Staraddons
Date Jan 17, 2026
Latest version 1.2.2
Statistics
Views 5
Downloads 0
Version 0
Developer
Staraddons
Resource author
More resources
Back
Top