TYPO3 Fluid single engine - php

Is it possible to get FLUID as a Standalone template engine like Twig?
I do not want to use TYPO3 (Neos) neither do I want to use Flow. Since it is way to overkill for a small project.
Has everyone ever tried using Fluid as a Standalone template Engine?

The new answer to this question is: yes.
Here is standalone fluid: https://github.com/TYPO3/Fluid

I'm not aware of a stable and standalone version of the FLUID template engine, but have seen some projects on GitHub that at least contain the basic functionality and some of the ViewHelpers included in FLUID (see links below).
https://github.com/janvennemann/typo3-fluid-standalone
https://github.com/NamelessCoder/fluid

Related

I have to learn Typo3 or Drupal and I don't know where to start

So we got a great project and we absolutely have to learn Typo3 or Drupal for it quickly. I already know some basic things.
I did the installation correctly for both, I know how to set up a basic Site using Fluid Template in Typo3 and I know how to set up a basic template in drupal without any styles.
My Problem now is how do I style a website since typo3 or drupal doesn't have a field for classes (The fields just get some random ids) and also how can I build a website with multiple sections where I have to style each section individually.
If you have any links to good tutorials or anything else that explains what I need to know I would appreciate it.
First of all, i think you understand HTML/CSS and know that TYPO3,... are content management systems. They're wrapping your content (saved to the database) with a template like HTML Files to send the result to the browser as a full rendered website.
ThomasLöffler already gave you the hint to read the documentation on both websites to make your choice which one you want to use. I prefer TYPO3, but the start many years ago wasn't easy. So i could you explain a little bit, and on a very short way what you need to do... After all please read the docs on typo3.org (Gettin started guide or something)
In TYPO3 you need to include and build your HTML Template. Prefered with the FLUID Template Engine / Framework. After that you need to set it with the TYPO3 TypoScript as your main template.
The content templates like will be rendered by the TYPO3 Extension "fluid_styled_content". This extension has also fluid templates to render the content object into a html output. Before you have enough knowledge about typo3 it's not recomended to change them.
The main thing is, that you need to include a stylesheet (css) file in your site. In TYPO3's TypoScript it's for example like this:
page.includeCSS.file100 = path/to/your/css/mystyle.css
Thats the very short overview and very little explanation what to do. But as Thomas said, you need to understand both and decide for one of them. And of course you need to read the docs first a little bit, before you ask. That would help you and each of us, to give you better answers. Good luck!
TYPO3 Gett started:
https://docs.typo3.org/typo3cms/GettingStartedTutorial/Introduction/Index.html
You can learn a lot of things if you take a look into the code of the official introduction package (https://extensions.typo3.org/extension/introduction/) The package can simply installed over the extension manager -> get preconfigured distributions
Or you just use it as a basis to build your own layout. You do not have to reinvent the wheel ;)

Simple HTML site localization using with specific language routes

I want to translate a simple HTML site into two languages, I have always opted to duplicate the site and put each copy in a "language directory" as follows:
en/page.html
es/page.html
I feel the i18next library could be useful (for what I've read), but I would like to keep urls like in the previous case but with only one version of the file and I don't see a way to achieve this with such library.
Is this possible? Do I need to use node with express to achieve this? Or use a PHP solution?
Thanks for further answers.
Thanks
I think PHP solution is much more better than Javascript. For PHP multilanguage support check gettext, Below are few links which help you to understand
http://www.gnu.org/software/gettext/
https://blog.udemy.com/php-gettext/
complete example of gettext in php
http://blog.lingohub.com/2013/07/php-internationalization-with-gettext-tutorial/
Google Search: (php gettext tutorial)
Wordpress also use gettext libraries and tools for i18n.
http://codex.wordpress.org/I18n_for_WordPress_Developers

Code highlighter like on Symfony and Doctrine sites

I really like highlighting and tabs that are used for code snippets on symfony.com and doctrine-project.org sites.
I wish I knew how they managed to achive this. Probably they use some special JavaScript library?
From Symfony 2 online documentation:
The Symfony2 documentation uses reStructuredText as its markup
language and Sphinx for building the output
So go through these tools' documentation to get an idea on how you can adapt them to your site

Ember.js compatibility with mustache libraries

I am currently developing a PHP site which I plan to use with Mustache PHP so that I can use the same mustache template files with my PHP rendering as well as with my javascript (ajax driven) page updates. After searching around, I was not able to find a handlebars.js equivalent library for PHP, although I would prefer to use handlebars for everything.
I am in the process of deciding whether to use Ember.js or Backbone.js. I know that Ember uses handlebars and that handlebars uses syntax and features not present in mustache.js, which it is based on. I also understand that handlebars.js works with mustache templates just fine.
I am leaning towards Ember and am willing to fork and update Mustache PHP to work with Handlebars.js if necessary.
But first of all, will Ember.js work nicely with straight mustache templates? Or does the proper leveraging of Ember also imply the use of template features that only handlebars supports?
If I do have to fork the PHP library, what are the main handlebars features I will be itching to add in first?
Thanks in advance, this will really help me decide if it is worth it for me to use Ember.js.
Handlebar.js adds some "helpers" on the Mustache(.php/.js) syntax... But these are completely useless as Mustache does this already very well:
{{#each xyz}}...{{/each}} is the same as {{#xyz}}...{{/xyz}} in Mustache.
{{#if xyz}}...{{/if}} is the same as {{#xyz}}...{{/xyz}} in Mustache.
{{#with xyz}}...{{/with}} is the same as {{#xyz}}...{{/xyz}} in Mustache.
In contrast:
{{#unless xyz}}...{{/unless}} is the same as {{^xyz}}...{{/xyz}} in Mustache.
Ember.js looks very much like handlebar.js, while Backbone.js seems to add a lot of logic to the logic-agnostic Mustache-Kind-of-rendering some output.
I'm using Mustache(php) on some small and large sites. Ajax calls result in Mustache filling out a peice of html and jQuery replaces some dom elements with the result. It's working like a charm.
To me: Don't add logic to Mustache, just remove the logic from Handlebar.js (I guess it will work without those "helpers" as well.)
I didn't need to use Ember but did notice that not long after I posted this question, someone else began the project of Handlebars parsing within PHP and this library is another approach. These libraries were the solution I was looking for since there were so many potential complications with treating handlebars templates using only a mustache renderer.

Implementing master pages functionality. PHP

How to make master pages in php? Like a Layout.cshtml (and RenderBody()) in ASP.NET MVC?
Thanks!
P.S. Maybe there's a third-party tool for the purpose?
EDIT
Ok. The thing is not about MVC architecture! Do look here: http://jsfiddle.net/challenger/8qn22/109/
I want the master page/layout to stay when user gets redirected to the other page
Want an average page to be nested inside the content division. So if it is a form I want this form to be displayed like: http://jsfiddle.net/challenger/XgFGb/17/
Here's what PHP standard framework/api supports:
The require("/definitions.php") function loads class, function and constants defines from a file and outputs the content outside of PHP code to php://stdout (on a webserver this is what is sent to the browser). You might wanna use require_once for importing dependencies (php files with definitions).
Use the PHP's open and close tags to obtain something close to templating functionality.
For example a normal page would look like this:
while an included (and repeatably includable) one could look like this:
I'm not saying "don't use templating engines", just showing a clear and simple way of achieving things which PHP is purposely built for. If this is enough for you needs, I then do say "don't use templating engines for the sake of it" (btw, if you are tidy, you can easily separate logic from views, without strict and sometimes cumbersome MVC frameworks).
Off hand, I know that the Laravel framework includes the Blade templating engine. It uses a syntax very similar to Razor.
Example:
#layout('master')
#section('navigation')
#parent
<li>Nav Item 3</li>
#endsection
#section('content')
Welcome to the profile page!
#endsection
(Razor, Blade, loller skates)
In PHP, there is a very similar technique called templating. Instead of a master page, you have a template. The language itself has no built-in templating features, but there are third-party templating engines (Smarty, PHPTAL, and XTemplate, to name a few).
If you want to have "real" master pages, it is entirely possible to implement them. Just wrap you master page into a class and include() that class into your content pages.
Also Zend Framework supports a two step view, where a view template is rendered inside a layout template. I think this satisfies your need for master pages.
See following links:
Approximating Master Pages in PHP
Is there anything like MasterPages on CodeIgniter Framework?
PHP Equivalent of Master page in ASP.NET
ASP.Net MVC or Zend Framework. What is your opinion
http://hoolihan.net/blog-tim/2008/09/24/simple-masterpages-with-php/
The Twig template engine offers Template Inheritance
The most powerful part of Twig is template inheritance. Template inheritance allows you to build a base "skeleton" template that contains all the common elements of your site and defines blocks that child templates can override.
Can be used as a standalone, but was made by the people behind the popular symfony framework.
A while ago (several years), I achieved something like this using Smarty, and extending it to contain a method to the effect of DisplayMaster("NameOfTemplate", "NameOfMasterTemplate")
It works by rendering a template and passing the result into another (master) template.
Above has 2 templates:
NameOfTemplate, just has the main content section, e.g.
<div>...{$someProcessing}</div>
NameOfMasterTemplate has the outer html
<html>...<body><div class="layout">{$innerHtml}</div></body></html>
Ok. The solution that suits me the best is described here http://www.phpro.org/tutorials/Introduction-to-PHP-templating.html#9. It is easy, fast to imlement and doesn't enforce you to use a templating engine. Cool!
Add this piece of code in the content area of your master.php file...
I am using it like this and it perfectly working for me
<li>BLOG</li>
<div class="container content">
<?php
if(isset($_GET['page']))
{
$page_name = $_GET['page'];
include("/".$page_name);
}
?>
</div>

Categories