Do you have some feature in mind that you'd love to see in Couch? Let us know.
2 posts Page 1 of 1
The answer to this has a broader scope.

My cart is based on price in special units. Decimal precision is always 1, instead of 2 by default.
Globally reconfigure this value is definitely helpful. But it takes touching of core Couch tags.php.

This can also be done in the form of some redefining in kfunctions.php.
General guideline is very welcomed, so devs can have new functions, based on what is provided by default.

Many default tags could face customization. Name a few: number_format, listfolders, menu, each, dropdownfolders, search.

The broad scope of the request includes not only new customized values, but added functionality.
Who knows what devs can share else. Maybe pages tag will be hypothetically enriched with zebra logic, showing every odd or even page. This now is on shoulders of the Couch Authors (like the added random='1').

I'm deeply sorry if this is all silly for a php programmer. I see people here on forum proposing their addons once in a while. I have never seen though, an extention for base tags, or customization of them.

As we discussed here (viewtopic.php?p=22187#p22187), Couch allows all its tags to be redefined.

I think that would be one way of enhancing the existing tags (i.e. by replacing them altogether by your own code).

For more complex tags (notably <cms:pages>), instead of replacing entire function altogether, one would usually only want to tweak certain features within it. If you take a look at how cms:pages has been implemented, you'll find that it raises events at almost all important steps e.g.
Code: Select all
// HOOK: alter_page_tag_params
$FUNCS->dispatch_event( 'alter_page_tag_params', array(&$attr, $params, $node, &$mode) );


// HOOK: alter_valid_orderby
$FUNCS->dispatch_event( 'alter_valid_orderby', array(&$arr_acceptable_orderby, &$arr_canonical_orderby, $params, $node, $rec_tpl) );

// HOOK: alter_page_tag_query
$FUNCS->dispatch_event( 'alter_page_tag_query', array(&$distinct, &$count_query_field, &$count_query_field_as, &$query_fields, &$query_table, &$sql, &$group_by, &$having, &$order_sql, &$limit_sql, &$mode, $params, $node, $rec_tpl) );

Search for '$FUNCS->dispatch_event' and you'll see that you are allowed to inject your own code in the default flow thus altering things to your desire.

As an example, please see viewtopic.php?p=22294#p22294 where we use this technique to create an 'enhanced' cms:search tag that, for most parts, only piggybacks on existing core code.

That would be the second method of altering existing tags. Of course both methods assume familiarity both with PHP and Couch's code.

Do you think there is more that could be done to do what you mentioned?
I'd be interested in knowing that.

2 posts Page 1 of 1

Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 1 guest