First fake subscriber model to show namespacing and autoloading.
This commit is contained in:
@@ -165,6 +165,7 @@ class Initializer {
|
|||||||
|
|
||||||
public function admin_page() {
|
public function admin_page() {
|
||||||
// set data
|
// set data
|
||||||
|
$subscriber = new \MailPoet\Models\Subscriber();
|
||||||
$this->data = array(
|
$this->data = array(
|
||||||
'title' => __('Twig Sample page'),
|
'title' => __('Twig Sample page'),
|
||||||
'text' => 'Lorem ipsum dolor sit amet',
|
'text' => 'Lorem ipsum dolor sit amet',
|
||||||
@@ -172,7 +173,8 @@ class Initializer {
|
|||||||
'users' => array(
|
'users' => array(
|
||||||
array('name' => 'Joo', 'email' => 'jonathan@mailpoet.com'),
|
array('name' => 'Joo', 'email' => 'jonathan@mailpoet.com'),
|
||||||
array('name' => 'Marco', 'email' => 'marco@mailpoet.com'),
|
array('name' => 'Marco', 'email' => 'marco@mailpoet.com'),
|
||||||
)
|
),
|
||||||
|
'subscriber' => $subscriber->name
|
||||||
);
|
);
|
||||||
// Sample page using Twig
|
// Sample page using Twig
|
||||||
echo $this->renderer->render('index.html', $this->data);
|
echo $this->renderer->render('index.html', $this->data);
|
||||||
|
11
lib/models/subscriber.php
Normal file
11
lib/models/subscriber.php
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?php namespace MailPoet\Models;
|
||||||
|
if (!defined('ABSPATH')) exit;
|
||||||
|
|
||||||
|
class Subscriber {
|
||||||
|
|
||||||
|
public $name;
|
||||||
|
|
||||||
|
public function __construct () {
|
||||||
|
$this->name = 'First Subscriber';
|
||||||
|
}
|
||||||
|
}
|
@@ -25,10 +25,13 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<h3>Autoloaded Subscriber</h3>
|
||||||
|
<p>{{ subscriber }}</p>
|
||||||
|
|
||||||
<!-- Notice -->
|
<!-- Notice -->
|
||||||
<h3>Notices</h3>
|
<h3>Notices</h3>
|
||||||
<p><a href="javascript:;" onclick="MailPoet.Notice.success('Test');">Trigger success</a></p>
|
<p><a href="javascript:;" onclick="MailPoet.Notice.success('Test');">Trigger success</a></p>
|
||||||
<p><a href="javascript:;" onclick="MailPoet.Notice.error('Test');">Trigger error</a></p>
|
<p><a href="javascript:;" onclick="MailPoet.Notice.error('Test');">Trigger error</a></p>
|
||||||
<p><a href="javascript:;" onclick="MailPoet.Notice.system('Test');">Trigger warning</a></p>
|
<p><a href="javascript:;" onclick="MailPoet.Notice.system('Test');">Trigger warning</a></p>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Reference in New Issue
Block a user