Skip to content

Commit

Permalink
Updating Link formats
Browse files Browse the repository at this point in the history
- Links now use the baseurl

Signed-off-by: RJ Garcia <rj@bighead.net>
  • Loading branch information
ragboyjr committed Jan 20, 2018
1 parent 04459ef commit 1ca2575
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 35 deletions.
8 changes: 4 additions & 4 deletions doc/engine/extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ title: Extensions
Extensions
==========

Creating extensions couldn't be easier, and can really make Plates sing for your specific project. Start by creating a class that implements `\League\Plates\Extension\ExtensionInterface`. Next, register your template [functions](/engine/functions/) within a `register()` method.
Creating extensions couldn't be easier, and can really make Plates sing for your specific project. Start by creating a class that implements `\League\Plates\Extension\ExtensionInterface`. Next, register your template [functions]({{ site.baseurl }}{% link engine/functions.md %}) within a `register()` method.

## Simple extensions example

Expand Down Expand Up @@ -41,7 +41,7 @@ To use this extension in your template, simply call your new functions:
<p>Hello, <?=$this->e($this->uppercase($name))?></p>
~~~

They can also be used in a [batch](/templates/functions/#batch-function-calls) compatible function:
They can also be used in a [batch]({{ site.baseurl }}/templates/functions/#batch-function-calls) compatible function:

~~~ php
<h1>Hello <?=$this->e($name, 'uppercase')</h1>
Expand Down Expand Up @@ -87,7 +87,7 @@ To use this extension in your template, first call the primary function, then th

## Loading extensions

To enable an extension, load it into the [engine](/engine/) object using the `loadExtension()` method.
To enable an extension, load it into the [engine]({{ site.baseurl }}{% link engine/index.md %}) object using the `loadExtension()` method.

~~~ php
$engine->loadExtension(new ChangeCase());
Expand Down Expand Up @@ -117,4 +117,4 @@ class MyExtension implements ExtensionInterface
// ...
}
}
~~~
~~~
6 changes: 3 additions & 3 deletions doc/engine/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ title: Functions
Functions
=========

While [extensions](/engine/extensions/) are awesome for adding additional reusable functionality to Plates, sometimes it's easier to just create a one-off function for a specific use case. Plates makes this easy to do.
While [extensions]({{ site.baseurl }}{% link engine/extensions.md %}) are awesome for adding additional reusable functionality to Plates, sometimes it's easier to just create a one-off function for a specific use case. Plates makes this easy to do.

## Registering functions

Expand All @@ -27,8 +27,8 @@ To use this function in a template, simply call it like any other function:
<h1>Hello <?=$this->e($this->uppercase($name))</h1>
~~~

It can also be used in a [batch](/templates/functions/#batch-function-calls) compatible function:
It can also be used in a [batch]({{ site.baseurl }}/templates/functions/#batch-function-calls) compatible function:

~~~ php
<h1>Hello <?=$this->e($name, 'uppercase')</h1>
~~~
~~~
14 changes: 7 additions & 7 deletions doc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ Plates is a native PHP template system that's fast, easy to use and easy to exte

## Highlights

- Native PHP templates, no new [syntax](/templates/syntax/) to learn
- Native PHP templates, no new [syntax]({{ site.baseurl }}{% link templates/syntax.md %}) to learn
- Plates is a template system, not a template language
- Plates encourages the use of existing PHP functions
- Increase code reuse with template [layouts](/templates/layouts/) and [inheritance](/templates/inheritance/)
- Template [folders](/engine/folders/) for grouping templates into namespaces
- [Data](/templates/data/#preassigned-and-shared-data) sharing across templates
- Preassign [data](/templates/data/#preassigned-and-shared-data) to specific templates
- Built-in [escaping](/templates/escaping/) helpers
- Easy to extend using [functions](/engine/functions/) and [extensions](/engine/extensions/)
- Increase code reuse with template [layouts]({{ site.baseurl }}{% link templates/layouts.md %}) and [inheritance]({{ site.baseurl }}{% link templates/inheritance.md %})
- Template [folders]({{ site.baseurl }}{% link engine/folders.md %}) for grouping templates into namespaces
- [Data]({{ site.baseurl }}/templates/data.md#preassigned-and-shared-data) sharing across templates
- Preassign [data]({{ site.baseurl }}/templates/data#preassigned-and-shared-data) to specific templates
- Built-in [escaping]({{ site.baseurl }}{% link templates/escaping.md %}) helpers
- Easy to extend using [functions]({{ site.baseurl }}{% link engine/functions.md %}) and [extensions]({{ site.baseurl }}{% link engine/extensions.md %})
- Framework-agnostic, will work with any project
- Decoupled design makes templates easy to test
- Composer ready and PSR-2 compliant
Expand Down
4 changes: 2 additions & 2 deletions doc/templates/data.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ $template->data(['name' => 'Jonathan']);

## Accessing data

Template data is available as locally scoped variables at the time of rendering. Continuing with the example above, here is how you would [escape](/templates/escaping/) and output the "name" value in a template:
Template data is available as locally scoped variables at the time of rendering. Continuing with the example above, here is how you would [escape]({{ site.baseurl }}{% link templates/escaping.md %}) and output the "name" value in a template:

~~~ php
<p>Hello <?=$this->e($name)?></p>
Expand Down Expand Up @@ -58,4 +58,4 @@ To assign data to ALL templates, simply omit the second parameter:
$templates->addData(['name' => 'Jonathan']);
~~~

Keep in mind that shared data is assigned to a template when it's first created, meaning any conflicting data assigned that's afterwards to a specific template will overwrite the shared data. This is generally desired behavior.
Keep in mind that shared data is assigned to a template when it's first created, meaning any conflicting data assigned that's afterwards to a specific template will overwrite the shared data. This is generally desired behavior.
4 changes: 2 additions & 2 deletions doc/templates/escaping.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Escaping is a form of [data filtering](http://www.phptherightway.com/#data_filte

## Batch function calls

The escape functions also support [batch](/templates/functions/#batch-function-calls) function calls, which allow you to apply multiple functions, including native PHP functions, to a variable at one time.
The escape functions also support [batch]({{ site.baseurl }}/templates/functions/#batch-function-calls) function calls, which allow you to apply multiple functions, including native PHP functions, to a variable at one time.

~~~ php
<p>Welcome <?=$this->e($name, 'strip_tags|strtoupper')?></p>
Expand All @@ -47,4 +47,4 @@ Some [libraries](http://framework.zend.com/manual/2.1/en/modules/zend.escaper.es

Probably the biggest drawbacks to native PHP templates is the inability to auto-escape variables properly. Template languages like Twig and Smarty can identify "echoed" variables during a parsing stage and automatically escape them. This cannot be done in native PHP as the language does not offer overloading functionality for it's output functions (ie. `print` and `echo`).

Don't worry, escaping can still be done safely, it just means you are responsible for manually escaping each variable on output. Consider creating a snippet for one of the above, built-in escaping functions to make this process easier.
Don't worry, escaping can still be done safely, it just means you are responsible for manually escaping each variable on output. Consider creating a snippet for one of the above, built-in escaping functions to make this process easier.
6 changes: 3 additions & 3 deletions doc/templates/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Template functions in Plates are accessed using the `$this` pseudo-variable.

## Custom fuctions

In addition to the functions included with Plates, it's also possible to add [one-off functions](/engine/functions/), or even groups of functions, known as [extensions](/engine/extensions/).
In addition to the functions included with Plates, it's also possible to add [one-off functions]({{ site.baseurl }}{% link engine/functions.md %}), or even groups of functions, known as [extensions]({{ site.baseurl }}{% link engine/extensions.md %}).

## Batch function calls

Expand All @@ -30,7 +30,7 @@ Sometimes you need to apply more than function to a variable in your templates.
<p>Welcome <?=$this->batch($name, 'strip_tags|strtoupper|escape')?></p>
~~~

The [escape](/templates/escaping/) functions also support batch function calls.
The [escape]({{ site.baseurl }}{% link templates/escaping.md %}) functions also support batch function calls.

~~~ php
<p>Welcome <?=$this->e($name, 'strip_tags|strtoupper')?></p>
Expand All @@ -44,4 +44,4 @@ The batch functions works well for "piped" functions that accept one parameter,

<!-- Will output: jonathan -->
<?=$this->batch('Jonathan', 'escape|strtoupper|strtolower')?>
~~~
~~~
6 changes: 3 additions & 3 deletions doc/templates/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ title: Templates
Templates
=========

Plates templates are very simple PHP objects. Generally you'll want to create these using the two factory methods, `make()` and `render()`, in the [engine](/engine/). For example:
Plates templates are very simple PHP objects. Generally you'll want to create these using the two factory methods, `make()` and `render()`, in the [engine]({{ site.baseurl }}{% link engine/index.md %}). For example:

~~~ php
// Create new Plates instance
Expand All @@ -20,11 +20,11 @@ echo $templates->render('partials/header');
echo $templates->render('profile', ['name' => 'Jonathan']);
~~~

For more information about how Plates is designed to be easily added to your application, see the section on [dependency injection](/engine/#dependency-injection).
For more information about how Plates is designed to be easily added to your application, see the section on [dependency injection]({{ site.baseurl }}/engine/#dependency-injection).

## Manually creating templates

It's also possible to create templates manually. The only dependency they require is an instance of the [engine](/engine/) object. For example:
It's also possible to create templates manually. The only dependency they require is an instance of the [engine]({{ site.baseurl }}{% link engine/index.md %}) object. For example:

~~~ php
// Create new Plates instance
Expand Down
8 changes: 4 additions & 4 deletions doc/templates/inheritance.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ title: Inheritance
Inheritance
===========

By combining [layouts](/templates/layouts/) and [sections](/templates/sections/), Plates allows you to "build up" your pages using predefined sections. This is best understand using an example:
By combining [layouts]({{ site.baseurl }}{% link templates/layouts.md %}) and [sections]({{ site.baseurl }}{% link templates/sections.md %}), Plates allows you to "build up" your pages using predefined sections. This is best understand using an example:


## Inheritance example

The following example illustrates a pretty standard website. Start by creating a site template, which includes your header and footer as well as any predefined content [sections](/templates/sections/). Notice how Plates makes it possible to even set default section content, in the event that a page doesn't define it.
The following example illustrates a pretty standard website. Start by creating a site template, which includes your header and footer as well as any predefined content [sections]({{ site.baseurl }}{% link templates/sections.md %}). Notice how Plates makes it possible to even set default section content, in the event that a page doesn't define it.

<div class="filename">template.php</div>
~~~ php
Expand Down Expand Up @@ -40,7 +40,7 @@ The following example illustrates a pretty standard website. Start by creating a
</html>
~~~

With the template defined, any page can now "implement" this [layout](/templates/layouts/). Notice how each section of content is defined between the `start()` and `end()` functions.
With the template defined, any page can now "implement" this [layout]({{ site.baseurl }}{% link templates/layouts.md %}). Notice how each section of content is defined between the `start()` and `end()` functions.

<div class="filename">profile.php</div>
~~~ php
Expand All @@ -60,4 +60,4 @@ With the template defined, any page can now "implement" this [layout](/templates
<li><a href="/link">Example Link</a></li>
</ul>
<?php $this->stop() ?>
~~~
~~~
6 changes: 3 additions & 3 deletions doc/templates/layouts.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The `layout()` function can be called anywhere in a template, since the layout t
<p>Hello, <?=$this->e($name)?></p>
~~~

This function also works with [folders](/engine/folders/):
This function also works with [folders]({{ site.baseurl }}{% link engine/folders.md %}):

~~~ php
<?php $this->layout('shared::template') ?>
Expand All @@ -36,7 +36,7 @@ To assign data (variables) to a layout template, pass them as an array to the `l

## Accessing the content

To access the rendered template content within the layout, use the `section()` function, passing `'content'` as the section name. This will return all outputted content from the template that hasn't been defined in a [section](/templates/sections/).
To access the rendered template content within the layout, use the `section()` function, passing `'content'` as the section name. This will return all outputted content from the template that hasn't been defined in a [section]({{ site.baseurl }}{% link templates/sections.md %}).

~~~ php
<html>
Expand Down Expand Up @@ -99,4 +99,4 @@ Plates allows stacking of layouts, allowing even further simplification and orga
<article>
<?=$this->e($article->content)?>
</article>
~~~
~~~
4 changes: 2 additions & 2 deletions doc/templates/nesting.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Including another template into the current template is done using the `insert()
<?php $this->insert('partials/footer') ?>
~~~

The `insert()` function also works with [folders](/engine/folders/):
The `insert()` function also works with [folders]({{ site.baseurl }}{% link engine/folders.md %}):

~~~ php
<?php $this->insert('partials::header') ?>
Expand All @@ -41,4 +41,4 @@ To assign data (variables) to a nested template, pass them as an array to the `i
<p>Your content.</p>

<?php $this->insert('partials/footer') ?>
~~~
~~~
2 changes: 1 addition & 1 deletion doc/templates/sections.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ title: Sections
Sections
========

The `start()` and `stop` functions allow you to build sections (or blocks) of content within your template, and instead of them being rendered directly, they are saved for use elsewhere. For example, in your [layout](/templates/layouts/) template.
The `start()` and `stop` functions allow you to build sections (or blocks) of content within your template, and instead of them being rendered directly, they are saved for use elsewhere. For example, in your [layout]({{ site.baseurl }}{% link templates/layouts.md %}) template.

## Creating sections

Expand Down
2 changes: 1 addition & 1 deletion doc/templates/syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ While the actual syntax you use in your templates is entirely your choice (it's
## Guidelines

- Always use HTML with inline PHP. Never use blocks of PHP.
- Always escape potentially dangerous variables prior to outputting using the built-in escape functions. More on escaping [here](/templates/escaping/).
- Always escape potentially dangerous variables prior to outputting using the built-in escape functions. More on escaping [here]({{ site.baseurl }}{% link templates/escaping.md %}).
- Always use the short echo syntax (`<?=`) when outputting variables. For all other inline PHP code, use full the `<?php` tag. Do not use [short tags](http://us3.php.net/manual/en/ini.core.php#ini.short-open-tag).
- Always use the [alternative syntax for control structures](http://php.net/manual/en/control-structures.alternative-syntax.php), which are designed to make templates more legible.
- Never use PHP curly brackets.
Expand Down

0 comments on commit 1ca2575

Please sign in to comment.