Welcome, Guest. Please login or register.
Did you miss your activation email?
May 25, 2012, 06:12:51 PM

Login with username, password and session length
Search:     Advanced search
Interested in joining the WebsiteBaker team?
For more Information read here or on our new website.
155520 Posts in 21712 Topics by 7738 Members
Latest Member: chris85
* Home Help Search Login Register
Pages: 1 [2]   Go Down
Print
Author Topic: Upcoming: Template Engine (x_FastTemplate2 compatible)  (Read 4112 times)
WebBird
Guest
« Reply #25 on: September 23, 2009, 12:31:22 PM »

There's another update (see link above).

It's now possible to {{ :include }} other template files.
Logged
mr-fan

Offline Offline

Posts: 1556


WWW
« Reply #26 on: September 28, 2009, 10:45:27 PM »

hi bianka,

started testing today/night....looks nice...i've start with a little template with the setup....and you know where i'm stuck? jes on the SM2 call.... grin like to see your template engine with the EM for website baker 3.0

you did a great job!

if i finished the template i will post it as a example for usage...but this takes maby two weeks (work is hard - much work in my office and homeside on my farm... smiley)

i want finish some tutorials for the new project, too - so time is precious!

just a feedback for you that i don't forget to test your work...

regards martin (wish you a quiet week)
Logged

 
WebBird
Guest
« Reply #27 on: September 29, 2009, 09:37:30 AM »

Thank you, Martin! grin There are some (unresolved) issues with many nested {{ :if }} and {{ :loop }} statements, but on the whole it seems to work pretty good.

I don't think that the Engine will be included with WB 3.0, but hey, you're still free to use it. grin
Logged
WebBird
Guest
« Reply #28 on: September 29, 2009, 10:11:03 AM »

Here's a complete usage example:

Template (WB Backend):

Code:
{{ :include admin_header.htt }}
<form action="{{ action }}" method="post">
  <input type="hidden" name="do" value="users" />
    <table>
{{ :if users }}
    <tr>
{{ :comment Suchformular }}
      <td colspan="3">
          <label for="search">{{ FILTER }}:</label>
            <input type="text" name="search" id="search" value="{{ search }}" />
          <input type="submit" value="{{ BUTTON_SEARCH }}" />
          <input type="submit" id="reset" name="reset" value="{{ BUTTON_RESET }}" />
      </td>
      <td colspan="3">
        <form action="{{ action }}" method="post">
          <input type="hidden" name="do" value="users" />
          <label for="limit">Anzeigen pro Seite:</label>
            <select id="limit" name="limit">
              <option value="10">10</option>
              <option value="25">25</option>
              <option value="50">50</option>
              <option value="100">100</option>
            </select>
          <input type="submit" value="{{ SAVE }}" />
        </form>
      </td>
    </tr>
    <tr>
      <th><button class="btn" id="so" name="so" value="email" type="submit">{{ EMAIL }}</button></a></th>
      <th><button class="btn" id="so" name="so" value="votes" type="submit">{{ VOTES }}</button></th>
      <th>{{ REG_DATE }}</th>
      <th>{{ LASTVOTE_DATE }}</th>
      <th>{{ LASTVOTE_ITEM }}</th>
      <th></th>
    </tr>
{{ :loop users }}
    <tr>
      <td>{{ email }}</td>
      <td>{{ votes }}</td>
      <td>{{ regdate }}</td>
      <td>{{ last_vote_date }}</td>
      <td>{{ last_vote_item }}</td>
      <td><a href="{{ action }}&amp;do=users&amp;id={{ user_id }}">{{ HISTORY }}</a></td>
    </tr>
{{ :loopend }}
    <tr>
      <td colspan="3">{{ prevlink }}</td>
      <td colspan="3" style="text-align: right;">{{ nextlink }}</td>
    </tr>
{{ :ifend }}
<!-- BEGIN template comment -->
    <tr>
      <td colspan="6" style="text-align: right;">
        <input type="submit" name="save" class="button" value="{{ save }}" />
      </td>
    </tr>
<!-- END template comment -->
{{ :if nodata }}
    <tr><td colspan="6">{{ nodata }}</td></tr>
{{ :ifend }}
    </table>
</form>
{{ :include footer.htt }}


Code to fill and print the template:

Code:
<?php

    
if(!defined('WB_PATH')) die(header('Location: index.php'));

    
// get language strings
    
global $MOD_VOTES$TEXT;

    
// include the lib
    
include_once dirname(__FILE__).'/../wblib/class.wbTemplate.php';

    
// create an instance
    
$tpl   = new wbTemplate();

    
// >>>>> the following instructions can be used in any order
    
    // remove empty placeholders
    
$tpl->setBehaviour'remove' );

    
// set template dir
    
$tpl->setPathdirname(__FILE__).'/templates' );

    
// set template file to use
    
$tpl->setFile'admin_users.htt' );

    
// <<<<<
    
    // get the template data
    
$tpldata = array (
  
'action' => 'http://localhost/_projects/wb28/backend/admintools/tool.php?tool=voteforanything&do=users',
  
'prevlink' => NULL,
  
'nextlink' => NULL,
  
'search' => NULL,
  
'tabs' => '<li> <a href="http://localhost/_projects/wb28/backend/admintools/tool.php?tool=voteforanything&do=overview" >Übersicht</a></li>
<li> <a href="http://localhost/_projects/wb28/backend/admintools/tool.php?tool=voteforanything&do=users" id="current" >Benutzer</a></li>'
,
  
'users' =>
  array (
    
=>
    array (
      
'user_id' => '6',
      
'email' => 'b...@....de',
      
'password' => '*94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29',
      
'regdate' => '28.09.2009 18:03:43',
      
'reg_ip' => '127.0.0.1',
      
'votes' => '4',
      
'lastvote' => '1254155959',
      
'vkey' => 'UJOYtdHmfAnkhtXDJHbNLHZy0NYBaX9l',
      
'vote_history' =>
      array (
        
=>
        array (
          
'page' => '33',
          
'item' => '2',
          
'timestamp' => 1254155168,
        ),
        
=>
        array (
          
'page' => '33',
          
'item' => '2',
          
'timestamp' => 1254155529,
        ),
        
=>
        array (
          
'page' => '33',
          
'item' => '2',
          
'timestamp' => 1254155833,
        ),
        
=>
        array (
          
'page' => '33',
          
'item' => '2',
          
'timestamp' => 1254155959,
        ),
      ),
      
'locked' => 'N',
      
'last_vote_date' => '28.09.2009 18:39:19',
      
'last_vote_item' => '2<br /><span class="mod_votes_small">(Seite: VoteTest)</span>',
    ),
  ),
);

    
// print template; mix template data with language strings
    
$tpl->printTemplatearray_merge$tpldata$MOD_VOTES$TEXT ) );

?>


Result: See Screenshot
Logged
mr-fan

Offline Offline

Posts: 1556


WWW
« Reply #29 on: September 30, 2009, 12:50:32 PM »

hi bianka,

if made a little testtemplate for the frontend....without Page_content(); and showmenu2();

but for a short demonstration that it works at this state... wink

just install WBLib as module + the attached template install as template...

it's a round-box-demonstration from the web if found somewhere...

if you implement frontendtemplating functions to use showmenu or page_content i will provide to improve the demotemplate to get a basic example for creating templates...for frontend

userfriendly for useing such functions id like to see something like this ==> if this is possible! i don't know that! so it is more a question instead of a request.... grin grin

in xft2 the call of a function is like this one...with capture_echo:
Code:
    <?php //nice colors mode    
'pagehead'                => $xft2->capture_echo ("simplepagehead();"),
        
'description'            => $xft2->capture_echo ("page_description();"),
        
'keywords'                => $xft2->capture_echo ("page_keywords();")

in WBLib it could be maybe easyer to read & use own functions that set up before in the index.php
like:

Code:
    <?php //nice colors mode   
'mainmenu'         => get_by_function ("showmenu2(1);")
with a special call for such "content" or only.....?
'mainmenu'         => capture_echo ("showmenu2(1);")


i don't know - take you some time to think in calm about it

real good work until now!

regards martin
Logged

 
WebBird
Guest
« Reply #30 on: September 30, 2009, 02:03:43 PM »

Thanks for testing and sharing your work! smiley It's good to hear that the template engine works for you.

There are still some open points, capture_echo() (or something similar) is one of the more important ones. ({{ else }} is another one.)
Logged
mr-fan

Offline Offline

Posts: 1556


WWW
« Reply #31 on: October 01, 2009, 06:48:35 AM »

no problem - if you've take the time (absolute no reason for haste only if you realy have a breach  wink) i will extend the demonstration...

like:

Step 1: basic engine usage
Step 2: call functions
Step 3: usage of comments
Step 4: different options for markers (like :if :else :loop)

and so on!

just send me your work per mail or write me a PM!

regards martin
Logged

 
WebBird
Guest
« Reply #32 on: October 01, 2009, 10:33:09 AM »

I am working on a template showcase, or to be more exact: An index.php that will work with most templates I can think of. For example, it looks into the Database to see how many content blocks are on the current page, calling page_content() for each of them, and allocating a placeholder named page_content_<number>.

The benefit is that, in most cases, you will only have to create the template, add the index.php, and are ready to go.

The drawback is that looking into the database and maybe calling a bunch of methods not used in the current template, will cause an overhead.

But hey, you're still free to create you're own index.php with less "intelligence". grin
Logged
WebBird
Guest
« Reply #33 on: October 01, 2009, 03:11:46 PM »

Here's the template showcase I promised. I used the Vincent03 Template. You will have to install wblib v0.6 to check this out.

http://www.websitebakers.com/pages/libs/wblib.php
Logged
Stefek
WebsiteBaker Org e.V.

Offline Offline

Posts: 4884



« Reply #34 on: October 08, 2009, 01:41:21 AM »

Wow, ich kann nur wow sagen.
Irgendwie ist der Post an mir vorübergezogen.

Ich werde sicher einige Fragen haben, sobald ich etwas Zeit finde. Sieht aber super aus und mit meinen recht geringen php Kenntnissen kann ich nur staunen, was so alles geht.

Viele Grüße.
Stefek

Logged

"In a time of universal deceit, telling the truth becomes a revolutionary act."
- George Orwell, Nineteen eighty-four (1984)
WebBird
Guest
« Reply #35 on: October 12, 2009, 02:44:19 PM »

As of V0.7, the template engine can handle combined conditionals.

Example:

Code:
{{ :if prevlink || nextlink }}
    <tr>
      <td colspan="4">{{ prevlink }}</td>
      <td colspan="3" style="text-align: right;">{{ nextlink }}</td>
    </tr>
{{ :ifend }}

In this example, the code block will be removed if neither 'prevlink' nor 'nextlink' are set.
Logged
WebBird
Guest
« Reply #36 on: January 28, 2010, 06:26:43 PM »

For docs in english, see http://www.webbird.de/wblib/en
Logged
Stefek
WebsiteBaker Org e.V.

Offline Offline

Posts: 4884



« Reply #37 on: March 18, 2010, 12:42:39 PM »

Hello Bianka,

where is your Lib now?
Can't find it - no where.

Is this still work in progress or did you give it up?

I wanted to test the template engine.

Regards,
Stefek
Logged

"In a time of universal deceit, telling the truth becomes a revolutionary act."
- George Orwell, Nineteen eighty-four (1984)
Pages: 1 [2]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!