1 Replies - 143 Views - Last Post: 07 February 2012 - 01:46 AM Rate Topic: -----

Topic Sponsor:

#1 paayab  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 07-February 12

can use tag Instead php code <class:function attr1="value1"

Posted 07 February 2012 - 01:20 AM

hi
i have this class:

<?php
 
class template{
    public function blocks($blockName, $id){
        return "<div id='$id'>".loadModule($blockName)."</div>";
    }
}
 
$tmp = new template();
 
?>



what changes needed for i use $tmp object in pages with:

<tmp:blocks id="polls1" blockName="polls" />
OR
[tmp.blocks("polls1", "polls")]
OR
{tmp.blocks["polls1", "polls"]}



instead php code:

<?php echo $tmp->blocks("polls", "polls1");?>



Is it possible?

Is This A Good Question/Topic? 0
  • +

Replies To: can use tag Instead php code <class:function attr1="value1"

#2 Dormilich  Icon User is online

  • 痛覚残留
  • member icon

Reputation: 2146
  • View blog
  • Posts: 5,430
  • Joined: 08-June 10

Re: can use tag Instead php code <class:function attr1="value1"

Posted 07 February 2012 - 01:46 AM

you'll need a parser that translates the markup into callable PHP code.

the APF framework uses such an approach, maybe you can get some ideas off that.
Was This Post Helpful? 2
  • +
  • -

Page 1 of 1