2017 © Pedro Peláez
 

library vendi-template-router

WordPress template router

image

vendi-advertising/vendi-template-router

WordPress template router

  • Friday, February 16, 2018
  • by cjhaas
  • Repository
  • 1 Watchers
  • 1 Stars
  • 52 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 9 Versions
  • 21 % Grown

The README.md

README

The goal of this plugin was to better override WordPress's routing engine in a more explicit and controlled manner. There are times when you want the full power of WordPress's CMS backend but you want to take complete control of the rendering. Usually this scenario pops up most when you are developing an application instead of just a website., (*1)

At the time that this plugin was created the REST API was just entering beta and the work on the rewrite engine wasn't spoken of yet. (Hopefully that's coming soon, though!), (*2)

The general use-case for this plugin is for URL "folders" that you want to redirect to your own template folder based on name. For instance, if you want everything at https://www.example.com/app/ to go to your own application folder (which doesn't even need to live in the web root)., (*3)

This plugin can be installed as a normal plugin however it is recommended that you actually install this as an MU plugin., (*4)

To use this plugin you just need to register your route:, (*5)

\Vendi\Shared\template_router::register_context(
                                                <context_name>,
                                                <url_folder>,
                                                <template_location_root>,
                                                <magic_page = 'page'>,
                                                <template_subfolder = 'templates'>
                                            );
  • <context_name>
    • Arbitrary string name that represents URLs relative to <url_folder>.
    • If you want to ask the template_router to generate URLs later you'll need this.
  • <url_folder>
    • Arbitrary valid URL string that represents the "folder" that your application is served from.
  • <template_location_root>
    • The absolute path that requests to <url_folder> will be passed to.
  • <magic_page>
    • When passing the requested route to your template this query string variable will be used.
    • Make sure that your app does not depend on this value.
    • This value is optional and defaults to "page".
    • This parameter is poorly named and really should be "internal_query_string_key" or something.
  • <template_subfolder>
    • The subfolder relative to <template_location_root> that holds the templates for this route.
    • This value is optional and defaults to "templates"

Example

For a general application called Test that you want to have all routes start with test and with the WordPress install at /var/www/wordpress-root-folder/ and with templates living in /var/www/wordpress-root-folder/templates/ you would register your context using:, (*6)

\Vendi\Shared\template_router::register_context(
                                                'Test',
                                                'test',
                                                '/var/www/wordpress-root-folder/'
                                            );

The Versions

16/02 2018

dev-master

9999999-dev https://github.com/vendi-advertising/vendi-template-router

WordPress template router

  Sources   Download

MIT

The Requires

 

The Development Requires

vendi vendi-advertising

16/02 2018

1.3.6

1.3.6.0 https://github.com/vendi-advertising/vendi-template-router

WordPress template router

  Sources   Download

MIT

The Requires

 

The Development Requires

vendi vendi-advertising

16/02 2018

1.3.5

1.3.5.0 https://github.com/vendi-advertising/vendi-template-router

WordPress template router

  Sources   Download

MIT

The Requires

 

The Development Requires

vendi vendi-advertising

22/11 2017

1.3.4

1.3.4.0 https://github.com/vendi-advertising/vendi-template-router

WordPress template router

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

vendi vendi-advertising

22/11 2017

1.3.3

1.3.3.0 https://github.com/vendi-advertising/vendi-template-router

WordPress template router

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

vendi vendi-advertising

22/11 2017

1.3.2

1.3.2.0 https://github.com/vendi-advertising/vendi-template-router

WordPress template router

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

vendi vendi-advertising

26/04 2017

1.2.1

1.2.1.0 https://github.com/vendi-advertising/vendi-template-router

WordPress template router

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

vendi vendi-advertising

10/03 2017

1.1.4

1.1.4.0 https://github.com/vendi-advertising/vendi-template-router

WordPress template router

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

vendi vendi-advertising

10/03 2017

1.1.3

1.1.3.0 https://github.com/vendi-advertising/vendi-template-router

WordPress template router

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

vendi vendi-advertising