Hi guys,
I hope this one is straightforward.
I'm implementing a variation on the Joomla! simple search function, but which also includes data from a set of imported tables (public speaker profiles and categories). On the request form for this search I'm offering an option to alter the ordering of the search results, as shown here:
Depending on the option chosen for Ordering, there will be two different lists of fields produced for field list in the DB Read action's Order value. I can express the list of fields as a PHP variable or an array: let's say I compute it as a value named $ordering (whether it's a scalar or array value) before I run the DB Read action. So the ORDER BY field list I want is available as some kind of PHP variable by the time I get to the DB Read action.
My question is: can I use $ordering or some other form of expression in the Order value of the DB Read action? If so, how do I reference it? Curly brackets, $form->data['something'], or a PHP return value?
Thanks ...
I hope this one is straightforward.
I'm implementing a variation on the Joomla! simple search function, but which also includes data from a set of imported tables (public speaker profiles and categories). On the request form for this search I'm offering an option to alter the ordering of the search results, as shown here:

Depending on the option chosen for Ordering, there will be two different lists of fields produced for field list in the DB Read action's Order value. I can express the list of fields as a PHP variable or an array: let's say I compute it as a value named $ordering (whether it's a scalar or array value) before I run the DB Read action. So the ORDER BY field list I want is available as some kind of PHP variable by the time I get to the DB Read action.
My question is: can I use $ordering or some other form of expression in the Order value of the DB Read action? If so, how do I reference it? Curly brackets, $form->data['something'], or a PHP return value?
Thanks ...
Hi rsearle,
You might be able to do this by setting a Custom Condition and adding the ORDER BY to the end but a better solution may be to dynamically set the value of the Order By box. You can set any of the parameters using the action ID - shown after the action name in the Setup tab. For example - where 99 is the Action ID here
Bob
You might be able to do this by setting a Custom Condition and adding the ORDER BY to the end but a better solution may be to dynamically set the value of the Order By box. You can set any of the parameters using the action ID - shown after the action name in the Setup tab. For example - where 99 is the Action ID here
<?php
$form->actions_config['99']['order'] = 'speaker_profile';
?>
or dynamically<?php
$form->actions_config['99']['order'] = $form->data['order'];
?>
This needs to go into a Custom Code action before the DB Read action.
Bob
Hi Bob,
Now that's a good trick. Hidden under the covers, and just what I needed for this job.
Thanks very much. Have a beer on me.
Russell
Now that's a good trick. Hidden under the covers, and just what I needed for this job.
Thanks very much. Have a beer on me.
Russell
This topic is locked and no more replies can be posted.