Giter Club home page Giter Club logo

Comments (14)

leledumbo avatar leledumbo commented on July 19, 2024

Original fcl-web which brook is based on has fptemplate (moved to fcl-base since it's proven to be usable outside of web environment)
silvio has jtemplate
I have qtemplate and view (not yet uploaded, I'll do later)

Each has different features

from brookframework.

silvioprog avatar silvioprog commented on July 19, 2024

The JTemplate link is: https://github.com/silvioprog/jtemplate
What the link of QTemplate?

from brookframework.

leledumbo avatar leledumbo commented on July 19, 2024

What the link of QTemplate?

I haven't uploaded it, because I develop in office (which I haven't sent to my home computer yet, and my office internet is very limited). I'm going to send it home today.

However, I also have view: https://dl.dropboxusercontent.com/u/22124591/view.tar.gz

Both are built on top of FPTemplate, with different concept. View is more passive, for instance with the following template:

$(News
  [Content=
    <div class="news">
      <div class="post-title">~PostTitle</div>
      <div class="posted-by">Posted by ~Poster</div>
      <div class="date">on ~Date</div>
      <div class="post-content">~PostContent</div>
    </div>
  ]
  [Separator=<hr />]
)

Example code to use them:

procedure THomeAction.Get;
var
  HomeView: TView;
  TempVar: TViewVariable;
begin
  StyleSheets.Add('news.css');
  HomeView := TView.Create('templates/home.html');

  TempVar := HomeView['News'];

  TempVar.Value := StringsReplace(
    TempVar['Content'],
    ['~PostTitle','~Poster','~Date','~PostContent'],
    ['Test Title 1','Admin',DateTimeToStr(Now),'<p>Test Post 1</p>'],
    [rfReplaceAll]
  );
  TempVar.Value := TempVar.Value + TempVar['Separator'];
  TempVar.Value := TempVar.Value + StringsReplace(
    TempVar['Content'],
    ['~PostTitle','~Poster','~Date','~PostContent'],
    ['Test Title 2','Admin',DateTimeToStr(Now),'<p>Test Post 2</p>'],
    [rfReplaceAll]
  );

  Content := HomeView.GetContent;
  HomeView.Free;
end;

QTemplate on the other hand still preserve the event driven approach, only now for each tag, user must create a callback instead of centralized in a single method. The class is the one responsible for tag checking and calling the appropriate callback.

ATM, QTemplate is faster because it traverse the template only once, while View does it twice (first to get the tags, second to replace them).

from brookframework.

leledumbo avatar leledumbo commented on July 19, 2024

Here's QTemplate: https://dl.dropboxusercontent.com/u/22124591/qtemplate.zip

from brookframework.

silvioprog avatar silvioprog commented on July 19, 2024

Are you versioning the QTemplate? It can be a Book plugin.

from brookframework.

leledumbo avatar leledumbo commented on July 19, 2024

I'm uploading to bitbucket

from brookframework.

leledumbo avatar leledumbo commented on July 19, 2024

I've improved the test program quite a lot to show the usefulness. I don't know whether it's a good idea to make it part of Brook (jtemplate is not part of Brook as well, isn't it?). Besides, I like Mercurial much better than Git due to sane and more powerful and easier to use GUI frontend (TortoiseHg).

from brookframework.

silvioprog avatar silvioprog commented on July 19, 2024

To do its very simple, add "Brook plugin" on README of your project and make a small demo showing how to use the plugin with Brook.

I use Github because it is more accessed than Bitbuket, and the interface is very clean and intuitive. My Git GUI is SmartGIT, it is free (for non comercial use) and have several features to manage GIT. It runs on Linux/Windows too, with the same interface. :)

from brookframework.

silvioprog avatar silvioprog commented on July 19, 2024

... soon, I will create the page "http://brookframework.org/plugins" and upload all Brook plugins for it. :)

from brookframework.

leledumbo avatar leledumbo commented on July 19, 2024

I'll see whether it's possible to use both git and mercurial for the same repo directory. both seems to use one hidden folder on project top dir only (.git / .hg) so in theory there should be no problem

Sent from my Android phone with mail.com Mail. Please excuse my brevity.

from brookframework.

leledumbo avatar leledumbo commented on July 19, 2024

Cloned in github, added sample usage with brook (taken from brook static file broker demo): https://github.com/leledumbo/QTemplate

from brookframework.

silvioprog avatar silvioprog commented on July 19, 2024

Thank you very much! Soon I'll upload all Brook plugins to: http://brookframework.org/plugins 👍

from brookframework.

silvioprog avatar silvioprog commented on July 19, 2024

Can I close this issue buddy?

from brookframework.

silvioprog avatar silvioprog commented on July 19, 2024

Closed for lack feedback. 👍

from brookframework.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.