Questions tagged [phptal]

PHPTAL is a templating engine for PHP5 that implements the brilliant Zope Page Templates syntax.

PHPTAL is a templating engine for PHP5 that implements the brilliant Zope Page Templates syntax, TAL and METAL.

Tag usage

When asking questions about the template syntax, consider adding (for TAL template constructs) and / or (for METAL macro constructs) as needed.

38 questions
8
votes
3 answers

How do I conditionally add an id attribute in TAL (PHPTAL)?

I'm creating a form elements template file in PHPTAL. I would like to be able to OPTIONALLY pass in an id attribute for a field... So far the code looks like this:
5
votes
2 answers

Cache block with twig

I've switched from Phptal to Twig: very better experience. However, in phptal I did "tal:cache" to cache some blocks of code... with Twig, how can I accomplish that?
Oscar Fanelli
  • 3,337
  • 2
  • 28
  • 40
4
votes
3 answers

Sql query from database

I need some help with how I can soft query from sql. I have a php script with an html page who is showing the result from the query. I have this query: $ready_orders = DB::query( 'SELECT * FROM ordertable where orderid is NOT null ORDER by id…
4
votes
2 answers

Zebra Striping with PHPTAL?

I'm trying out PHPTAL and I want to render a table with zebra stripes. I'm looping through a simple php assoc array ($_SERVER). Note that I don't want to use jQuery or anything like that, I'm trying to learn PHPTAL usage! Currently I have it working…
starmonkey
  • 3,147
  • 2
  • 20
  • 15
3
votes
1 answer

URL gets appended with $_GET-parameters automatically after AJAX request

I have the following source: $('#loginnow').click(function() { var login_useroremail = $('input[name="login_useroremail"]').val(); var login_password = $('input[name="login_password"]').val(); $.ajax({ …
HappyCoder
  • 61
  • 8
3
votes
1 answer

Tal condition, defining multiple conditions within same line

Is there an alternative to what I do below : ...
...
... Such as : ...
Pumpkin
  • 1,993
  • 3
  • 26
  • 32
3
votes
2 answers

PHPTAL: how to dump an object to see all properties

I have to modify the PHPTAL template below by adding another field, "location"
Name: contact name
Number:
Xoundboy
  • 827
  • 15
  • 26
2
votes
2 answers

PHPTAL -Trying to get property of non-object while using macros

I am using PHPTAL 1.2.2 Template page is template.tpl
Ugesh Gali
  • 2,042
  • 4
  • 20
  • 24
2
votes
2 answers

PHPTAL: graceful treatment of undefined variables

If I use a variable that hasn't been put into the scope, PHPTAL throws an exception. Is there any way of making PHPTAL fall back to graceful defaults, for example evaluating to false in a boolean context, to a blank in a string context, etc?
user8599
2
votes
1 answer

PHPTAL i18n Call to a member function on a non-object Error

I'm using PHPTAL in my project I'm able to successfully implement it almost all the cases except when I want to use its i18n services. I constantly get errors "Call to a member function on a non-object" I've tried searching the net forums etc. but…
rashid2538
  • 769
  • 5
  • 9
2
votes
1 answer

use phptal to insert value in

i am first time user of PHPTAL and i am not able to provide value to input box using PHPTAL i have three files 1.index.php require_once 'includes/lib/PHPTAL-1.2.2/PHPTAL.php'; // create a new template object $template = new…
2
votes
1 answer

How to print unclosed tags in PHPTAL Macros

I'm in the process of transitioning a site to using PHPTAL templates, for now I am writing all new pages using templates while leaving the existing pages as is. The older pages use a standard header and footer, a typical page has it's content…
J.R.
  • 21
  • 3
2
votes
1 answer

PHPTAL and nested templates. Possible?

I've been playing around with PHPTAL for the last couple of days. Overall I really like it. It's been much easier to get into than most others I've looked into. I am having one particular problem, though. Here's the issue. I am trying to nest two…
MK_Dev
  • 3,291
  • 5
  • 27
  • 45
1
vote
1 answer

PHPTAL Conditional Attribute

Given a metal macro that looks like this: And a template which uses the macro like…
FtDRbwLXw6
  • 27,774
  • 13
  • 70
  • 107
1
vote
2 answers

PHPTAL Dynamic Table Generation

I find myself creating various tables for tabular data quite a bit, and would like to create a macro that can dynamically create tables based on a data structure defined in the calling template (not in the PHP code). Here's a simplistic…
FtDRbwLXw6
  • 27,774
  • 13
  • 70
  • 107
1
2 3