mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 10:24:26 +02:00
move demo files to demo directory
This commit is contained in:
@@ -1,5 +0,0 @@
|
|||||||
title = Welcome to Smarty!
|
|
||||||
cutoff_size = 40
|
|
||||||
|
|
||||||
[setup]
|
|
||||||
bold = true
|
|
25
index.php
25
index.php
@@ -1,25 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
require 'Smarty.class.php';
|
|
||||||
|
|
||||||
$smarty = new Smarty;
|
|
||||||
|
|
||||||
$smarty->compile_check = true;
|
|
||||||
$smarty->debugging = true;
|
|
||||||
|
|
||||||
$smarty->assign("Name","Fred Irving Johnathan Bradley Peppergill");
|
|
||||||
$smarty->assign("FirstName",array("John","Mary","James","Henry"));
|
|
||||||
$smarty->assign("LastName",array("Doe","Smith","Johnson","Case"));
|
|
||||||
$smarty->assign("Class",array(array("A","B","C","D"), array("E", "F", "G", "H"),
|
|
||||||
array("I", "J", "K", "L"), array("M", "N", "O", "P")));
|
|
||||||
|
|
||||||
$smarty->assign("contacts", array(array("phone" => "1", "fax" => "2", "cell" => "3"),
|
|
||||||
array("phone" => "555-4444", "fax" => "555-3333", "cell" => "760-1234")));
|
|
||||||
|
|
||||||
$smarty->assign("option_values", array("NY","NE","KS","IA","OK","TX"));
|
|
||||||
$smarty->assign("option_output", array("New York","Nebraska","Kansas","Iowa","Oklahoma","Texas"));
|
|
||||||
$smarty->assign("option_selected", "NE");
|
|
||||||
|
|
||||||
$smarty->display('index.tpl');
|
|
||||||
|
|
||||||
?>
|
|
@@ -1,2 +0,0 @@
|
|||||||
</BODY>
|
|
||||||
</HTML>
|
|
@@ -1,6 +0,0 @@
|
|||||||
<HTML>
|
|
||||||
<HEAD>
|
|
||||||
{popup_init src="/javascripts/overlib.js"}
|
|
||||||
<TITLE>{$title} - {$Name}</TITLE>
|
|
||||||
</HEAD>
|
|
||||||
<BODY bgcolor="#ffffff">
|
|
@@ -1,83 +0,0 @@
|
|||||||
{config_load file=test.conf section="setup"}
|
|
||||||
{include file="header.tpl" title=foo}
|
|
||||||
|
|
||||||
<PRE>
|
|
||||||
|
|
||||||
{* bold and title are read from the config file *}
|
|
||||||
{if #bold#}<b>{/if}
|
|
||||||
{* capitalize the first letters of each word of the title *}
|
|
||||||
Title: {#title#|capitalize}
|
|
||||||
{if #bold#}</b>{/if}
|
|
||||||
|
|
||||||
The current date and time is {$smarty.now|date_format:"%Y-%m-%d %H:%M:%S"}
|
|
||||||
|
|
||||||
Tooltip example: Move your mouse over the <A HREF="" {popup sticky=true caption="Smarty pop-up text" delay=400 text="This is an example of a tooltip. Tooltips are handy for context sensitive information, and extremely easy to add to your templates with Smarty and the integration of <a href='http://www.bosrup.com/web/overlib/'>overLIB</a> by Erik Bosrup"} onclick="return false;">Help</A> link to see an example of a tooltip using Smarty's popup function.
|
|
||||||
|
|
||||||
The value of global assigned variable $SCRIPT_NAME is {$SCRIPT_NAME}
|
|
||||||
|
|
||||||
Example of accessing server environment variable SERVER_NAME: {$smarty.server.SERVER_NAME}
|
|
||||||
|
|
||||||
The value of {ldelim}$Name{rdelim} is <b>{$Name}</b>
|
|
||||||
|
|
||||||
variable modifier example of {ldelim}$Name|upper{rdelim}
|
|
||||||
|
|
||||||
<b>{$Name|upper}</b>
|
|
||||||
|
|
||||||
|
|
||||||
An example of a section loop:
|
|
||||||
|
|
||||||
{section name=outer loop=$FirstName}
|
|
||||||
{if %outer.index% is odd by 2}
|
|
||||||
{%outer.rownum%} . {$FirstName[outer]} {$LastName[outer]}
|
|
||||||
{else}
|
|
||||||
{%outer.rownum%} * {$FirstName[outer]} {$LastName[outer]}
|
|
||||||
{/if}
|
|
||||||
{sectionelse}
|
|
||||||
none
|
|
||||||
{/section}
|
|
||||||
|
|
||||||
An example of section looped key values:
|
|
||||||
|
|
||||||
{section name=sec1 loop=$contacts}
|
|
||||||
phone: {$contacts[sec1].phone}<br>
|
|
||||||
fax: {$contacts[sec1].fax}<br>
|
|
||||||
cell: {$contacts[sec1].cell}<br>
|
|
||||||
{/section}
|
|
||||||
<p>
|
|
||||||
|
|
||||||
testing strip tags
|
|
||||||
{strip}
|
|
||||||
<table border=0>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<A HREF="{$SCRIPT_NAME}">
|
|
||||||
<font color="red">This is a test </font>
|
|
||||||
</A>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
{/strip}
|
|
||||||
|
|
||||||
</PRE>
|
|
||||||
|
|
||||||
This is an example of the html_select_date function:
|
|
||||||
|
|
||||||
<form>
|
|
||||||
{html_select_date start_year=1998 end_year=2010}
|
|
||||||
</form>
|
|
||||||
|
|
||||||
This is an example of the html_select_time function:
|
|
||||||
|
|
||||||
<form>
|
|
||||||
{html_select_time use_24_hours=false}
|
|
||||||
</form>
|
|
||||||
|
|
||||||
This is an example of the html_options function:
|
|
||||||
|
|
||||||
<form>
|
|
||||||
<select name=states>
|
|
||||||
{html_options values=$option_values selected=$option_selected output=$option_output}
|
|
||||||
</select>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
{include file="footer.tpl"}
|
|
Reference in New Issue
Block a user