Download the PHP package cara-tm/pat_if_amp without Composer

On this page you can find all versions of the php package cara-tm/pat_if_amp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package pat_if_amp

h1. pat_if_amp

"Download":https://github.com/cara-tm/pat_if_amp/releases | "Packagist":https://packagist.org/packages/cara-tm/pat_if_amp

AMP pages for "Textpattern CMS":http://textpattern.io/.

This conditional tag examines the URL of the current page and determines if the URL ends in 'amp.' This allows for a custom page to be rendered using the standards for Google's Accelerated Mobile Pages (AMP) project.

h2. Links

Don't forget to check out my other plugin that's also Google AMP compatible: "pat_article_social":https://github.com/cara-tm/pat_article_social

h2. Note

Since TXP 4.7+ and its new features, you can choose to use build-in tags solution instead of this plugin. Read more about from "this forum post by Oleg":https://forum.textpattern.com/viewtopic.php?pid=320549#p320549 (don't forget to add a TXP variable on the fly for further usages within you website):

bc.. AMP page

regular page

</txp:evaluate>

h2. Installing

Using "Composer":https://getcomposer.org:

bc. $ composer require cara-tm/pat_if_amp:*

Or download the latest version of the plugin from "the GitHub project page":https://github.com/cara-tm/pat_if_amp/releases, paste the code into the Textpattern Plugins administration panel, install and enable the plugin.

h2. pat_if_amp

h3. Attributes

  • @url@ string (optional): The location (URL) of the website. Default: @hu@ (website URL as set in the Textpattern preferences panel).
  • @subdomain@ string (optional): Sets the subdomain name of where to redirect to. Default: @amp@.
  • @permlink@ boolean (optional): if set to @0@ (false) the redirection for the same article's URL mode within the subdomain will be not made. Default: @1@ (true).

h3. Example

Place code similar to below within your individual article template header, so that the AMP page can be properly detected:

bc.

<link rel="amphtml" href="<txp:permlink />/amp/">

</txp:if_individual_article>

Place something similar to below within your individual article template to display the alternative formatting:

bc.

<txp:output_form form="standard_page" />

</txp:mkp_if_amp>

h2. Textpattern variable usage

A @@ with a true/false value (@1@ or @0@) is automatically generated, for testing when this is an AMP context or not.

h3. Usage

bc. AMP context

Normal context

</txp:if_variable>

h3. Example

bc. ...Do some AMP things... AMP Category 1 Link

...Do some normal (non-AMP) things...

</txp:if_variable>

This example concerns categories, use kind of the same model for @pages@ and/or @archives@.

h2. pat_amp_sanitize

A tag to render article text content without any inline styles. To use as a drop-in replacement of the standard Textpattern @@ tag and/or @@ tag.

h3. Attributes

  • @content@ string (optional): choose either @body@ or @excerpt@ article content to sanitize. Default: @body@.

h3. Usage

In an article Form context:

bc.

h2. pat_amp_redirect

A simple tag for web redirection to a subdomain name. Same behaviour as used in The Guardian website. Must be used with a mobiles detection script (i.e. adi_mobile plugin). Some web designers could choose to use a subdomain for their mobiles websites (may be not recommended, but the official AMP Blog is located in a subdomain, see: "https://amphtml.wordpress.com":https://amphtml.wordpress.com). In this case, the Textpattern multi-sites capacities makes things easier.

Note: Doesn't work on local server installations, only on live servers.

h3. Usage

bc.

Good advice: Copy the @config.php@ file of the main site into the subdomain configuration folder in order to share the same database. So, all articles written by the Copy Editors will be sent automatically to the 'AMP powered website' from only one Textpattern administration interface attached to the 'normal' website. But designers have a separate and cleaner space to build their AMP pages.

h3. Attributes

  • @url@ string (optional): The location (URL) of the website. Default: @hu@ (website URL as set in the Textpattern preferences panel).
  • @subdomain@ string (optional): Sets the subdomain name of where to redirect to. Default: @amp@.
  • @permlink@ boolean (optional): Choose to redirect the same individual article's title URL within the subdomain. Default: @0@ (false).

h3. Example

bc.

In this case, if your main domain is @example.com@, it redirects to the @amp.example.com@ subdomain and uses the same individual article's URL from the main domain.

h3. Acknowledgments

Many thanks to "Phil Wareham":http://www.designhive.com/contact/phil-wareham who tidied up this plugin code and its help file. Thank you to "Michael K. Pate":https://github.com/michaelkpate, for its original idea, who accepted to distribute my entire rewriting code as a 'pat' prefixed plugin.

!https://raw.githubusercontent.com/cara-tm/pat_if_amp/master/amp-project-textpattern-cms-mention.png!


All versions of pat_if_amp with dependencies

PHP Build Version
Package Version
Requires textpattern/lock Version >=4.6.0
textpattern/installer Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package cara-tm/pat_if_amp contains the following files

Loading the files please wait ....