TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 03-01-2011, 05:10 AM   #1 (permalink)
The Visitor
Newcomer 
 
Join Date: Feb 2011
Posts: 1
Thanks: 0
ugesh is on a distinguished road
Default PHPTAL -Trying to get property of non-object while using macros.

I am using PHPTAL 1.2.2 Template page is template.tpl

Code:
<form>
        <div tal:repeat="field fields">
                <tal:block tal:define="name repeat/field/key" metal:use-macro="${field/type}" />
        </div>
</form>

<tal:block metal:define-macro="text">
        <label>${field/label}</label><input name="${name}" type="text" value="${field/value}" />
</tal:block>

<tal:block metal:define-macro="select">
        <label>${field/label}</label><select name="${name}">
                <tal:block tal:repeat="value field/valuelist">
                        <option tal:condition="php:field.value != value" value="${value}">${value}</option>

                </tal:block>
        </select>
</tal:block>
And my php page is

Code:
<?php
  require_once 'PHPTAL.php';

  $fields = array(
    'name'   => array('label'=>'Name','type'=>'text','value'=>'Test User'),
    'user'   => array('label'=>'Age','type'=>'select','valuelist'=>array(1,2,3),'value'=>2) ,

    );
   $t = new PHPTAL('tempalte.tpl');
   $t->fields = $fields;
 try {
        echo $t->execute();
    }
    catch (Exception $e){
        echo $e;
    }

?>
I was getting an error in ie as "Trying to get property of non-object in C:\Windows\Temp\tpl_4d6be820_formonline1__HAfMCyjT SQl6RgUTRjXcHA.php on line 24"

But in firefox and chrome it works fine but i view source there was lot of html code in it other than that tag.
ugesh is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using the Clone Construct to Clone an Object Wildhoney Advanced PHP Programming 5 01-29-2013 11:51 AM
Using the factory pattern (mad rantings of a mind without coffee) sketchMedia Advanced PHP Programming 35 09-25-2009 11:05 AM
PHPTAL Macros File Error EnDLeSs Advanced PHP Programming 0 01-19-2009 10:28 PM
PHPTAL Macros file EnDLeSs Advanced PHP Programming 0 01-16-2009 02:12 AM
Object methods suddenly lagging? RobertK Advanced PHP Programming 9 01-11-2008 01:38 PM


All times are GMT. The time now is 08:58 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design