The document provides an overview of Advanced Fluid, an open source templating language for PHP. It discusses basic ingredients like object accessors and view helpers. It then covers more advanced features such as forms, partials to remove duplication, security protections, and developing custom view helpers and widgets. The goal of Advanced Fluid is to inspire people to share knowledge about this templating language.
4. Variables
$this->view->assign(‘blogTitle’, $blog->getTitle());
<h1>The name of the blog is: {blogTitle}</h1>
Inspiring people to
Advanced Fluid share
5. Object Accessors
$this->view->assign(‘blog’, $blog);
<h1>The name of the blog is: {blog.title}</h1>
Author: {blog.author}
Getters are called automatically can be nested
Inspiring people to
Advanced Fluid share
6. ViewHelpers Namespace
Output logic is encapsulated in View Helpers (Tags) Declaration
{namespace f=F3FluidViewHelpers}
v5
<f:link.action action=“someAction“>Administration</f:link.action>
Invocation of
v4 {namespace f=Tx_Fluid_ViewHelpers} a tag
<f:link.action action=“someAction“>Administration</f:link.action>
Namespace f is included automatically
Inspiring people to
Advanced Fluid share
7. Arrays
<f:link action=“show“ arguments=“{blog: blog, name: ‘Hello’}“>show
posting</f:link>
JSON object syntax objects as
arguments can be
used!
Inspiring people to
Advanced Fluid share
8. Summary: Basic Ingredients
Object accessors: {blog.title}
ViewHelpers: <f:for each=“{blog.posts}“ as=“post“>...</f:for>
Arrays
Inspiring people to
Advanced Fluid share
19. Improving the Edit Form
<h2>{post.title}</h2>
<f:format.date format="Y-m-d">{post.date}</f:format.date>
<f:form action="update" object="{post}" name="post">
<f:render partial="BlogPostForm" />
</f:form>
Inspiring people to
Advanced Fluid share
20. Improving the Edit Form
<h2>{post.title}</h2>
{post.date -> f:format.date(format:"Y-m-d")}
<f:form action="update" object="{post}" name="post">
<f:render partial="BlogPostForm" />
</f:form>
Inspiring people to
Advanced Fluid share
21. Tag Syntax vs Inline Syntax
<link rel="stylesheet" href="<f:uri.file path='myStyle.css' />" />
<link rel="stylesheet" href="{f:uri.file(path: 'myStyle.css')}" />
Both have their
use-cases!
Inspiring people to
Advanced Fluid share
24. Render Date as Image
<h2>{post.title}</h2>
{post.date -> f:format.date(format:"Y-m-d")
-> f:cObject(typoscriptObjectPath: 'lib.dateAsImage')}
TypoScript
lib.dateAsImage = IMAGE
lib.dateAsImage {
Use TypoScript
where it makes
file = GIFBUILDER
file {
10 = TEXT
}
}
10.current = 1
sense.
Inspiring people to
Advanced Fluid share
25. Summary: Advanced Features
Forms
XSS Protection
Inline Syntax
cObject ViewHelper
Inspiring people to
Advanced Fluid share
26. ToDo: Developing
ViewHelpers
-> Bild vom Kochen /
Backen?
MESSERBLOCK /
Messer an wand
Developing
ViewHelpers
http://freerangestock.com/details.php?gid=37&pid=11545
27. Fluid Core does not contain any output
logic, and no control structures!
37. IfViewHelper
<f:if condition="{blog.posts}">
<f:then>
... display blog posts ...
</f:then>
<f:else>
No Blog Posts Available
</f:else>
</f:if>
<li class="{f:if(condition: iteration.isFirst, then:
'isFirstElement')}">Some Element</li>
Inspiring people to
Advanced Fluid share
38. IfViewHelper
class IfViewHelper extends ...AbstractConditionViewHelper {
/**
* @param boolean $condition View helper condition
*/
public function render($condition) {
if ($condition) {
return $this->renderThenChild();
} else {
return $this->renderElseChild();
}
}
}
Inspiring people to
Advanced Fluid share
39. Widgets
Inspiring people to
Advanced Fluid share
40.
41. Sortable g
rid
nd ar
Ca le
a ti on
ag in AJAX
P Autoco
mpleti
on
Widgets encapsulate
complex (view-related)
functionality.
Alph
ps abe
le Ma tica
l lis
Go og ting
Inspiring people to
Advanced Fluid share
42. It's simple to use them!
Inspiring people to
Advanced Fluid share
43. It's simple to write them!
Inspiring people to
Advanced Fluid share