developer.jelix.org is not used any more and exists only for history. Post new tickets on the Github account.
developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.

Opened 12 years ago

Closed 8 years ago

#653 closed new feature (wontfix)

More flexibility in template plugins

Reported by: CreatixEA Owned by:
Priority: normal Milestone:
Component: jelix:tpl Version: 1.0.5
Severity: normal Keywords:
Cc: Blocked By:
Blocking: Documentation needed: no
Hosting Provider: Php version:

Description

Here is the problem of most frameworks : everything is closed to have more security. Means that all PHP functions are not represented in modifiers, plugins and so ...

There is then two possibilities :

  • Hacking the sources files wich means you can't update sources easily
  • Open your framework with a generic function that let you use all functions you want.

Here is the feature I propose :

# Make a new modifier like :

function jtpl_modifier_common_php( $string, $fonction, $args = '%s') {
        // Should be stopped if not activated in configuration file
	$tmp = "$result = $fonction(".sprintf($args, $string).');';
	eval($tmp);
	return $result;
}

# You could use it like : {$myvar|php:"myfunction":"'myfirstarg', %s"}

This should be activable/deactivable in the configuration file : means if you find that it's a opened hole you can close it (if your designers aren't the same as coders, ... and if you don't want let them play with all PHP functions)

Change History (4)

comment:1 Changed 12 years ago by laurentj

well... You forgot a third possibility : creating a dedicated modifier plugin (that you can put in your own plugin directory)

And "eval" function is very ugly in term of performance and security. Using call_user_func is better.

comment:2 Changed 12 years ago by CreatixEA

Sure, that's what I'm doing... But because I had this problem I tought other people have the same problem... That's why I'm asking to integer it inside the framework with the possibility to (de)active it in the configuration file.

But it's a "discussion" topic :) Just to know if there is a need or not :)

comment:3 Changed 12 years ago by laurentj

  • Summary changed from More flexibility to More flexibility in template plugins

comment:4 Changed 8 years ago by laurentj

  • Resolution set to wontfix
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.