Contents

Introduction
Welcome
System requirements
Licensing details
What is the registration
Quick start guide
Using PHPRunner
Working with projects
Navigation bar
Templates
What are templates
Cars
Classified ads
Events
Jobs
Knowledge base
News
Paypal
Real estate
Sporting
Vacation houses
Connecting to the database
Datasource tables
Master-detail relationship between tables
SQL query page
About SQL query designer
Query Designer
SQL
Results
Charts
Creating chart
Chart types
List of chart types
Accumulation chart
Area chart
Bubble chart
Column/Bar charts
Combined chart
Financial OHLC/Candlestick charts
Gauge chart
Line chart
Pie/Doughnut charts
Chart parameters
Chart appearance
Using SQL to shape chart data
Reports
Creating report and setting parameters
Report totals and layout
Choose pages
Choose fields
Fields order and totals
Miscellaneous settings
Security
Login page
User login settings
Advanced security settings
User group permissions
Dynamic Permissions
Audit and record locking
Choose theme
Visual Editor
About
Toolbars
Page Elements
Adding PHP code snippet
Adding CAPTCHA
Insert button
Insert Google Map
"View as" settings
"View as" settings: Custom
"View as" settings: Map
"Edit as" settings
Validation types
Lookup wizard
Menu builder
Events
Output directory settings
After you are done
FTP upload
FrontPage Publishing
Advanced topics
Events
Predefined actions
Send a simple email
Send an email with new data
Send an email with old data
Save new data in another table
Save old data in another table
Insert a record into another table
Check if a specific record exists
Display a message on the Web page
Redirect to another page
Sample events
Appearance
Add dropdown list box with values for search
Add foldable section
Change cell background color
Change font in dropdown list
Change row background color
Change width of edit box with AJAX popup
Change width of text field on Quick Search panel
Disable record editing
Hide controls on Add/Edit pages, based on logged user name
Redirect to details page after master record was added
Show data from master table on detail view/edit/add page
Show dropdown list of US states if US was selected in country list
Show pop-up window
Make search button return data only when search value was entered
Database
Before deleting a record check for related records
Select multiple values from checkboxes or a list field and have them appear as individual database entries
Show list of customer orders
Update multiple records on the List page
Update multiple tables
Dynamic SQL query
Email
Email selected records
Send an email with updated fields only
Send mass email to all users
Upload
Check size and extension of uploaded files
Rename uploaded files
Upload files to users folders
Misc
Check if start date is ealier than end date
Speed up data entry using events
Save user data in session variables
Implementing 'single sign on' feature
Redirect to user info edit page
Global events
Login page
Before process
Before login
After successful login
After unsuccessful login
Before display
JavaScript OnLoad
Menu page
Before process
Before display
Register page
Before process
Before registration
After successful registration
After unsuccessful registration
Before display
JavaScript OnLoad
Change password page
Before process
Before change password
After password changed
Before display
JavaScript OnLoad
Remind password page
Before process
Before password reminder sent
After password reminder sent
Before display
JavaScript OnLoad
After application initialized
Menu item: Modify
Table events
Add page
Before process
Before record added
After record added
Before display
JavaScript OnLoad
Copy page
OnLoad
Edit page
Before process
Before record updated
After record updated
Before SQL query
Before display
JavaScript OnLoad
List page
Before process
Before record deleted
After record deleted
After group of records deleted
Before SQL query
Before record processed
After record processed
Before display
JavaScript OnLoad
Get Row Count
Custom Query
Custom record fetch
Report page
Before process
Before display
Before SQL query
JavaScript OnLoad
Chart page
Before process
Before SQL query
Before display
JavaScript OnLoad
Update chart settings
Printer-friendly page
Before process
Before SQL query
Before record processed
After record processed
Before display
JavaScript OnLoad
View page
Before process
Before SQL query
Before display
JavaScript OnLoad
Search page
Before process
Before display
JavaScript OnLoad
Import page
Before record inserted
Before import started
After import finished
Export page
Before process
Before SQL query
JavaScript OnLoad
Before record exported
After table initialized
Page life cycle overview
Common event parameters
Programming topics
Data Access Layer
Debugging tips
How to calculate values on the fly
How to control Inline Add/Edit functionality from script
Javascript API
Master-details relationships
PHPRunner session variables
PHPRunner templates
runner_mail function
Template files processing rules (Files.txt)
Template language
Using JOIN SQL queries
Useful links
Publishing PHP application to the remote Web server
Using FTP client to publish PHP pages to the remote Web server
Using FrontPage to publish PHP pages to the remote Web server
Demo Account
What is the Demo Account?
Terms and Conditions
Enterprise Edition
Online report/chart builder
Online report/chart builder v2.0 - Installation notes
Creating web report
Creating web chart
Domain host instructions
Yahoo!
Connecting to MySQL
Configuring FTP
Publishing project via FTP
1&1
Connecting to MySQL
Configuring FTP
Publishing project via FTP
GoDaddy.com
Connecting to MySQL
Configuring FTP
Publishing project via FTP
WebHost4Life.com
Connecting to MySQL
Configuring FTP
Publishing project via FTP
MyHosting.com
Connecting to MySQL
Configuring FTP
Publishing project via FTP
InspiRunner.com
Connecting to MySQL
Configuring FTP
Publishing project via FTP
How to install local web server (XAMPP)
How to add external css/php/js files
Connect using PHP
AJAX-based Functionality
Multilanguage support
Stylesheets
Rich Text Editor plugins
PDF view settings
Web interface guide
Order PHPRunner online

 
Home
PHPRunner 5.2 manual
Prev Page Next Page
 
 

PHPRunner templates

 

PHPRunner uses built-in template language. PHPRunner templates cleanly separates your presentation layer (HTML, CSS, etc.) from your application code.

New template language was introduced in PHPRunner 5.0. The main idea is to simply visual templates moving all logic and javascript to PHP files. This makes Visual Editor stable and eliminates the need to reset pages.

PHPRunner 4.2 and older use Smarty as a template language. If you open a project created by previous version, all unmodified visual templates will be converted to new format automatically. Modified files won't be changed and still be using Smarty-based template language. To convert modified visual template to the new format use "Reset" and re-apply changes manually.

Template language reference

- all templates tags are enclosed within delimiters { and }. All content outside delimiters is displayed as static HTML.

- template variables start with dollar ($) sign. They may contain numbers, letters and underscores.

Example: {$variable_name}

{BEGIN block_name} {END block_name} is used to define block section (loops, condition statements).

Functions

· assign($name, $val) is used to assign value $val to the variable $name.
· assignbyref($name, &$val) is similar to assign() except for value $val is passed by reference. Use assignbyref() when $val variable is array. See {block body} example below.
· assign_section($name, $begin, $end) is used to define block section.
· assign_loopsection($name, &$data) is used to define loop section.
· display($template) renders and displays the template file.

How templates work

Template files (*.htm) can be found in templates directory under output directory.

Here is the basic example of how templates work:

list.php

include('libs/xtempl.php');

// create object

$xt = new Xtempl();

// assign some content. This would typically come from

// a database or other source, but we'll use static

// values for the purpose of this example.

$xt->assign('name''george smith');

$xt->assign('address''45th & Harris');

// display it

$xt->display('list.htm');

The template file then contains the output interspersed with tags that PHPRunner replaces with assigned content.

list.htm


output

<html>

<head>

<title>User Info</title>

</head>

<body>

User Information:<p>

Name: {$name}<br>

Address: {$address}<br>

</body>

</html>

 

<html>

<head>

<title>User Info</title>

</head>

<body>

User Information:<p>

Name: george smith<br>

Address: 45th & Harris<br>

</body>

</html>

{BEGIN} ... {END} blocks

Template file contains a set of code sections wrapped by {BEGIN ...} and {END ...}.

view.htm

{BEGIN Model_fieldblock}

  <tr><td class=shade width=150>Model</td><td width=250>

  {$Model_value}&nbsp;

  </td></tr>

{END Model_fieldblock}

In view.php file use the following:

$xt->assign("Model_fieldblock",true); - code snippet between {BEGIN ...} and {END ...} appears in the output.

$xt->assign("Model_fieldblock",true); - code snippet goes away.

How to deal with Javascript

Earlier we mentioned that javascript and some HTML tags like <form> and <input type=hidden ...> need to be moved to PHP code in order to keep templates clean.

On the server side javascript code needs to be assigned to body or end variables in block array.

list.php

// create an array

$body = array();

// code assigned to "begin" variable replaces {BEGIN body} tag

$body["begin"]='<form name="frmSearch" method="GET" action="carsadmin_cars_list.php">

<input type="Hidden" name="a" value="search">

<input type="Hidden" name="value" value="1">

</form>';

// code assigned to "end" variable replaces {END body} tag

$body["end"]="<script>if(document.getElementById('SearchFor'))

document.getElementById('ctlSearchFor').focus();</script>";

// using assignbyref() function as body is an array

$xt->assignbyref("body",$body);

Template file and generated output

list.htm


output

{BEGIN body}

...

{END body}

 

<form name="frmSearch" method="GET" action="carsadmin_cars_list.php">

<input type="Hidden" name="a" value="search">

<input type="Hidden" name="value" value="1">

</form>

...

<script>

if(document.getElementById('SearchFor'))

document.getElementById('ctlSearchFor').focus();

</script>

 

 

Converted from CHM to HTML with chm2web Standard 2.83 (unicode)