Kitchen Sink
One template using every ViewFish feature: comments, variables, piped functions, dynamic placeholders, isset/else, unless/else, loops with indexes, and default values.
Kitchen Sink: Event Cards
This example uses comments, variables, piped functions (ucwords, ucfirst, ellipsis, default), dynamic placeholders ([[year]], [[uniqid]], [[datetime]]), isset with else, unless with else, loops with indexes (@count, @total, @first, @last), and default values — all in one template.
Viewfish Developer Conference
Organized by Adam — 2026Date: March 15, 2025
Venue: Convention Center, Portland
A full-day conference covering modern PHP templating, performance optimization, and security best practices.
Capacity: 500 attendees
Tickets Available Early Bird: $49Speakers
-
Jane Doe — The future of PHP templating
(Keynote)
[1/4]
Jane is a senior engineer at Acme Corp with 15 years of expe… -
Bob Smith — Caching strategies for high-traffic sites
[2/4]
Bob runs infrastructure at Scale Inc. - Maria Garcia — Security in template engines [3/4]
-
Alex Chen — Building accessible UIs with templates
🎬 Closing act
[4/4]
Alex is a frontend architect passionate about accessibility …
Sponsors
Acme Corp • Widgets Inc • Cloud Nine Hosting • Dev Tools Co
Secret Workshop
Organized by TBD — 2026Date: Date not announced
Venue: Location TBD
No description provided.
Capacity: 20 attendees
SOLD OUTSpeakers
Speaker lineup coming soon.
Lightning Talks Night
Organized by Community meetup group — 2026Date: April 2, 2025
Venue: The Rusty Anchor Pub
Five-minute talks on anything tech. Bring your ideas and a sense of humor.
Tickets AvailableSpeakers
-
Pat Wilson — Why tabs beat spaces
(Keynote)
🎬 Closing act
[1/1]
Pat has mass opinions about whitespace and is not afraid to …
<?php
# require the templating library
require '../vendors/ViewFish/viewfish.php';
# instantiate a ViewFish object
$T = new ViewFish\viewfish();
# set the template path
$T->set_template_path(__DIR__.'/../templates/');
# load the event template
$template = $T->load_template("demo11");
# --- Event 1: Full details, multiple speakers, sponsors ---
$event1 = [
'title' => 'viewfish developer conference',
'organizer' => 'adam',
'color' => 'dark',
'event_date' => 'March 15, 2025',
'venue' => 'convention center, portland',
'description' => 'A full-day conference covering modern PHP templating, performance optimization, and security best practices.',
'capacity' => 500,
'sold_out' => '',
'early_bird' => '49',
'speakers' => [
['name' => 'jane doe', 'topic' => 'the future of PHP templating', 'bio' => 'Jane is a senior engineer at Acme Corp with 15 years of experience building web frameworks and templating engines.'],
['name' => 'bob smith', 'topic' => 'caching strategies for high-traffic sites', 'bio' => 'Bob runs infrastructure at Scale Inc.'],
['name' => 'maria garcia', 'topic' => 'security in template engines'],
['name' => 'alex chen', 'topic' => 'building accessible UIs with templates', 'bio' => 'Alex is a frontend architect passionate about accessibility and inclusive design patterns for the modern web.'],
],
'sponsors' => [
['name' => 'acme corp'],
['name' => 'widgets inc'],
['name' => 'cloud nine hosting'],
['name' => 'dev tools co'],
],
];
# --- Event 2: Minimal info, no speakers yet, sold out ---
$event2 = [
'title' => 'secret workshop',
'sold_out' => '1',
'capacity' => 20,
];
# --- Event 3: Partial info, one speaker, no sponsors ---
$event3 = [
'title' => 'lightning talks night',
'organizer' => 'community meetup group',
'color' => 'success',
'event_date' => 'April 2, 2025',
'venue' => 'the rusty anchor pub',
'description'=> 'Five-minute talks on anything tech. Bring your ideas and a sense of humor.',
'speakers' => [
['name' => 'pat wilson', 'topic' => 'why tabs beat spaces', 'bio' => 'Pat has mass opinions about whitespace and is not afraid to share them with anyone who will listen.'],
],
];
echo "<h4>Kitchen Sink: Event Cards</h4>";
echo "<p>This example uses <b>comments</b>, <b>variables</b>, <b>piped functions</b> (ucwords, ucfirst, ellipsis, default), <b>dynamic placeholders</b> ([[year]], [[uniqid]], [[datetime]]), <b>isset with else</b>, <b>unless with else</b>, <b>loops with indexes</b> (@count, @total, @first, @last), and <b>default values</b> — all in one template.</p><hr>";
echo $T->render($template, $event1);
echo $T->render($template, $event2);
echo $T->render($template, $event3);
{* This is a ViewFish comment — it won't appear in output *}
<div class="card mb-4">
<div class="card-header bg-{{color|default:"primary"}} text-white">
<h3>{{title|ucwords}}</h3>
<small>Organized by {{organizer|default:"TBD"|ucfirst}} — [[year]]</small>
</div>
<div class="card-body">
<p><strong>Date:</strong> {{event_date|default:"Date not announced"}}</p>
<p><strong>Venue:</strong> {{venue|default:"Location TBD"|ucwords}}</p>
{{isset $description}}<p>{{description}}</p>{{else}}<p class="text-muted"><em>No description provided.</em></p>{{/isset}}
{{isset $capacity}}<p><strong>Capacity:</strong> {{capacity}} attendees</p>{{/isset}}
{{unless $sold_out}}<span class="badge bg-success">Tickets Available</span>{{else}}<span class="badge bg-danger">SOLD OUT</span>{{/unless}}
{{isset $early_bird}}<span class="badge bg-warning text-dark">Early Bird: ${{early_bird}}</span>{{/isset}}
<h5 class="mt-3">Speakers</h5>
{{isset $speakers}}
<ol>
{{@loop data=speakers}}
<li>
{{isset $@first}}<strong>{{/isset}}
{{name|ucwords}} — <em>{{topic|default:"Topic TBD"|ucfirst}}</em>
{{isset $@first}} (Keynote)</strong>{{/isset}}
{{isset $@last}} 🎬 Closing act{{/isset}}
<small class="text-muted">[{{@count}}/{{@total}}]</small>
{{isset $bio}}<br><small>{{bio|ellipsis:60}}</small>{{/isset}}
</li>
{{/loop}}
</ol>
{{else}}
<p class="text-muted">Speaker lineup coming soon.</p>
{{/isset}}
{{isset $sponsors}}
<h5>Sponsors</h5>
<p>
{{@loop data=sponsors}}
{{name|ucwords}}{{unless $@last}} • {{/unless}}
{{/loop}}
</p>
{{/isset}}
</div>
<div class="card-footer text-muted">
Event ID: [[uniqid]] | Generated: [[datetime]]
</div>
</div>