Created
May 13, 2009 10:19
-
-
Save speedmax/110961 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{ 'Edit' | link_to_edit page }} | |
{{ 'Show me some love' | link_to_view page }} | |
{{ 'Delete them all' | link_to_delete page }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Recently i have been ask about Framework integration with h2o, particularly CakePHP and Zend | |
compare to rails restful named routes, full routes in php is so so painful, | |
If you build a thin template object layer, it will work even better | |
*/ | |
H2o::addFilter('link_to_(.*)', 'link_to_dynamic'); | |
function link_to_dynamic($type, $object, $args) { | |
$class = current(array_keys($object))); | |
return Router::url(array( | |
'controllers' => Inflector::pluralize($class), | |
'action' => $type, | |
'id' => $object[$class]['id'] | |
)); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment