Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Reverted from v. 8

...

Variables are needed to fill out your template with dynamic data that is provided by phpFox. These are things from the main content, side panels and the sites title.

 

{{ html }} Must be placed inside the <html> element.
<html {{ html }}>{{ header }}Yes{{ title }}Yes{{ }}Yes{{ content }} main content for the . This content changes each time a new page is loaded.Yes{{ errors }}Yes{{ share }}}}{{ bar_sm }} (Small screen)Nox{{ sticky_bar_xs }}{{{{ breadcrumb }}}}Yes{{ }}Yes{{ logo }}
VariableDescriptionRequiredVersion Added
{{ content }}Loads the directional and language settings Displays the main content for the site.

Yes

This content changes each time a new page is loaded.yes4.0
{{ left }}

Loads everything that is to be placed within <head></head>.

Primary side block. Loads blocks 1 & 9.yes4.0
{{ right }}

Displays the site title. Must be placed inside the HTML <title></title> elements.

Yes

4.0

{{{{ body }}}}

Loads id and class of body

Secondary side block. Loads blocks 3 & 10yes4.0
{{ js }}Loads all Javascript files at the footer. This must be placed before the </body> closing tag.yes4.0
{{ title }}Displays the site title. Must be placed inside the HTML <title></title> elements.yes4.0
{{ header }}

Displays any errors to the end user. This is usually placed above {{{{ content }}}}.

Loads everything that is to be placed within <head></head>.yes4.0
{{

Current user actions.

No

4.x

{{{{ menu }}}}

Loads the site menu.

Yes

4.x

{{{{ sticky_bar }}}}

Loads the notification panel for when a user is logged in.

Yes

html }}

Loads the directional and language settings for the site. Must be placed inside the <html> element.

Code Block
<html {{ html }}>
yes4.0
{{ body }}

Loads the pages ID and Class names. Must be placed inside the <body> element.

Code Block
<body {{ body }}>
yes4.0
{{ sticky_bar }}

Loads the notification panel for when a user is logged in.

Image Added

yes4.0
{{ location_11 }}

Loads the notification panel for when a user is logged in. (Extra small screen)

No

4.x

{{{{ nav }}}}

Combines from {{{{ share }}}}, {{{{ menu }}}} and {{{{ sticky_bar }}}}.

No

4.x

{{{{ notify }}}}

This component same as {{{{ sticky_bar }}}}.

No

4.x

{{{{ location_x }}}}

Loads all blocks belong to location x (x from 1 to 12).

Yes

4.x

This loads block 11 and is where the main header for a user profile is loaded. Its intended to
be above the main content and panels. 

Image Added

yes4.0
{{ breadcrumb }}Loads the sites breadcrumb, which include section titles and <h1></h1> tags for when viewing an item.yes4.0
{{ main_top }}Some sections support internal searching of that section. This loads the main search routine for these sections.yes4.0
{{ errors }}

Loads the sites logo and allows Admins to change it directly from the AdminCP.

Yes

4.0

{{{{ breadcrumb_menu }}}}

Actions menu Image Removed

Yes

4.x

{{{{ site_logo }}}}

Site name

No

4.x

{{{{ site_link }}}}

Print url of site

No

4.x

{{{{ menu_sub }}}}

Loads the sub menu (below main menu) Image Removed

Yes

4.x

{{{{ search }}}}

Loads search field.

No

4.x

{{{{ footer }}}}

Loads the site footer.

No

4.x

{{{{ copyright }}}}

Loads the copyright of site.

No

4.x

{{{{ top }}}}

Loads location 7 and 11.

No

4.x

{{{{ main_top }}}}

Loads location 7 with search field above.

No

4.x

{{{{ left }}}}

Loads location 1 and 9.

No

4.x

{{{{ right }}}}

Loads location 3 and 10.

No

4.x

{{{{ h1 }}}}

Loads current page header.

No

4.x

{{{{ menu_nav }}}}

Loads current page header.

No

4.x

{{{{ main_class }}}}

Loads classes of #main element.

No

4.x

Displays any errors to the end user. This is usually placed above {{ content }}.yes4.0
{{ logo }}Loads the sites logo and allows Admins to change it directly from the AdminCP.yes4.0

 

Functions

Functions allow you to apply conditional statements to templates and access objects passed along by phpFox.

string int string <br><br>: <br>: <br>: This <br><br>: <br><br>: <br><br>:
NameDescriptionUsageReturns
is_user()Checks to see if a user is logged in or not.
Code Block
{% if is_user() %}
Hello User!
{% endif %}
true on success, false on failure.
is_admin()Checks to see if a user is an admin.
Code Block
{% if is_admin() %}
Hello User!
{% endif %}
true on success, false on failure.

permalink(

string $route,

int $id,

string $title)

 


$route

URL path for your link.


$id

Unique ID number.


 

$title

Title of the item

 

 

Creates a permalink. This is an identical function provided
by our PHP permalink() function.
 This is handy when you want to create an
App that requires viewing an item, like a blog or video. This function follows
our default permalink rules and structure.
Code Block
<a href="{{ permalink('/foo', 1, 'Hello World') }}">Hello World</a>
Parsed permalink.

url(string $route)

 


$route

Route for your link.

Creates a link based on the route provided.
Code Block
<a href="{{ url('/foo') }}">Foo</a>
Parsed URL.

_p(string $phrase)

 


$phrase

Phrase to parse.

If your theme has any phrases or words you can wrap them in this function.
It will automatically create a phrase for Admins in case they wish to
translate your theme. 
Code Block
{{ _p('Hello World') }}
Returns the phrase passed to the function
if the translation does not exist. Otherwise
it returns the translated version. 
asset(string $image)

 


$image

Relative path to image in your themes assets/ folder.

Include images in your themes.

URL of image.

shorten(string $str, int $max_length) <br><br>$str: String to shorten.<br>$max_length: number of characters that $str will be shorten if longer than.

Shorten string.

Shortened string.

short_number(int $number) <br><br>$number: number to display in short type.

Diplay large number in short type.<br>Ex: short_number(1200) // this function will return 1k+

Short type number.

setting(string $var_name) <br><br>$var_name: setting var name.

Get value of a setting.

Value of given setting.

user_group_setting(string $var_name) <br><br>$var_name: user group setting var name.

Get value of a user group setting.

Value of given user group setting.

parse(string $str) <br><br>$str: text to parse.

Parse text. This function usually be used when we need to display text that added by user input.

Parsed string.

parse(string $str) <br><br>$str: text to parse.

Parse text. This function usually be used when we need to display text that added by user input.

Parsed string.

comments()

Display block comment.

Block comment HTML.

payment()

Display block payment.

Block payment HTML.

pager()

Display block pagination.

Block pagination HTML.

_p(string $var_name) <br><br>$var_name: phrase var name

Get translated phrase.

Translated phrase.

moment(int $timestamp) <br><br>$timestamp (optional): timestamp to convert to time phrase.

Get translated phrase.

If $timestamp is null, the result will be current timestamp, otherwise, the result will be time phrase (Ex: '5 seconds ago', '3 minutes ago'...).

asset($assetPath) <br><br>$assetPath (string or array): path to asset files.

Get path/load asset files in HTML.

If $assetPath is string, the result will be the path to that asset. If $assetPath is array, it will load asset files directly to HTML.

Code Block
// Will return full URL to image in your themes assets/ folder
<img src="{{ asset('foo.png') }}">
 
// Will return full URL to image in your themes assets/image/ folder
<img src="{{ asset('image/foo.png') }}">
 
URL of image.