mirror of
https://github.com/e107inc/e107.git
synced 2025-08-08 07:36:32 +02:00
Shortcode Wrappers etc.
@@ -10,15 +10,52 @@ As a quick reference:
|
||||
* Html `<table>` which use the class 'fcaption' on `<td>`, change the `<td>` to `<th>`. Using the `forumheader3` in the *admin area* is obsolete and can be removed.
|
||||
|
||||
### Templates
|
||||
#### Loading Templates
|
||||
e107 v2.x uses a new template loading system.
|
||||
Plugin templates should be stored in **e107_plugins/yourplugin/templates/** by default.
|
||||
The template file should contain a variable with the same name as your template file.
|
||||
The template file should contain a variable with the same name as your template file.
|
||||
Instead of including the template, below is the difference:
|
||||
|
||||
require_once(e_PLUGIN."myplugin/templates/myplugin_template.php"); // v1.x
|
||||
$MYPLUGIN_TEMPLATE = e107::getTemplate('myplugin'); // v2.x
|
||||
|
||||
..and then you can parse it the same way:
|
||||
|
||||
$text = $tp->parseTemplate($MYPLUGIN_TEMPLATE['start'], false, $my_shortcodes);
|
||||
|
||||
|
||||
#### Declaring the HTML Template
|
||||
|
||||
eg. If your file is called **myplugin_template.php** , within this file you might see something like this:
|
||||
|
||||
$MYPLUGIN_TEMPLATE['start'] = "<div>";
|
||||
$MYPLUGIN_TEMPLATE['end'] = "</div>";
|
||||
|
||||
#### Shortcode Wrappers.
|
||||
|
||||
In v1.x you might create a wrapper around a shortcode (only when there is data returned) using the following code in your template:
|
||||
|
||||
$sc_style['CONTACT_PERSON']['pre'] = "<small>".LANCONTACT_14."</small><div>";
|
||||
$sc_style['CONTACT_PERSON']['post'] = "</div>";
|
||||
|
||||
In v2.x there are two methods to add wrappers around your shortcodes.
|
||||
The way to declare them differs slightly from v1 in that we use a kind of 'shortcode-wildcard' `{---}`.
|
||||
|
||||
##### Global Shortcodes
|
||||
|
||||
A global shortcode wrapper. ie for shortcodes which are available site-wide. (for example those registered globally for use in menus or found in e107_core/shortcodes/single/)
|
||||
example:
|
||||
|
||||
$SC_WRAPPER['CONTACT_PERSON']= "<small>".LANCONTACT_14."</small><div>{---}</div>";
|
||||
|
||||
##### Template-Specific Shortcodes
|
||||
|
||||
A template-specific shortcode wrapper. ie. as used on a single page of your site.
|
||||
example:
|
||||
|
||||
$CONTACT_WRAPPER['form']['CONTACT_PERSON'] = "<small>".LANCONTACT_14."</small><div>{---}</div>";
|
||||
|
||||
|
||||
## Admin-Area
|
||||
The admin area of v2.x uses a special new admin handler (admin-ui).
|
||||
|
||||
|
Reference in New Issue
Block a user