-
☆ A M B ☆
- 3,112 Posts
Quote from: tkfm at Sep 27, 2010, 02:22 AM
No. The default value of sortBy parameter is "DESC".
See the default property of FirstChildRedirect snippet.
So, what does this part suppose to mean?
<?php // highlight
/* sort dir */
$sortDir = isset( $sortDir ) && $sortDir == 'DESC' ? $sortDir : 'ASC';
or should it be:
<?php // highlight
/* sort dir */
$sortDir = $scriptProperties['sortDir'] == 'DESC' ? $scriptProperties['sortDir'] : 'ASC';
Rico
Genius is one percent inspiration and ninety-nine percent perspiration.
Thomas A. Edison
MODx is great, but knowing how to use it well makes it perfect!
www.virtudraft.com
Security, security, security! |
Indonesian MODx Forum |
MODx Revo's cheatsheets |
MODx Evo's cheatsheets
Author of
Easy 2 Gallery 1.4.x,
PHPTidy,
spieFeed,
FileDownload R,
Upload To Users CMP,
Inherit Template TV,
LexRating,
ExerPlan,
Lingua,
virtuNewsletter,
Grid Class Key,
SmartTag,
prevNext
Maintainter/contributor of
Babel
Because it's hard to follow all topics on the forum, PING ME ON TWITTER
@_goldsky if you need my help.
No, is says that if it’s set and it’s ’DESC’ $sortDir = $sortDir (i.e., ’DESC’). If not, $sortDir = ’ASC’.
If there were no default property, it would be set to ’ASC’ by default, but since the default property is ’DESC’, that’s the default value. It is potentially confusing to people (like me) who look at the code and don’t know about the default property.
It’s designed to handle cases where the user sends something weird as a parameter (which would override the default property) or modifies the default parameter to something weird. Otherwise, the query might fail altogether. This way, it’s guaranteed to produce something.
-
☆ A M B ☆
- 24,524 Posts
Indeed, the concept is much like the difference between Templates (site templates) and tpls (mini-templates used by snippets to permit custom structuring of their output). There are system defaults that you can set, and there are defaults for the snippet itself in case there is no system default. I always think of MODx as the city hall; it has its rules and customs, then there snippets and other code module that are like my private household which operates within the city’s rules but has its own rules and customs. The city has no laws against my kid picking his nose at the supper table, but he won’t get much supper if he tries it at home! So the city (in the US, in any case, certainly not here in Israel!) probably has a law against spitting on the sidewalk, while at home I have laws against publicly picking one’s nose.
Nice analogy.
I think people are also confused by the difference between settings and properties.
Settings are available across the whole site (global scope).
User Settings override Context Settings, which override System Settings.
Properties are available in specific elements (local scope)
Properties set with parameters (&propertyname=`value`) override properties in attached property sets, which override the element’s default properties.
Inside a snippet (or other element) it’s impossible to tell where a property or setting’s value came from because the overrides happen at a higher level -- before the value reaches the element.
I have some problems with sortBy.
I have TV called "total_area". Snippet is called [[!FirstChildRedirect? &sortBy=`total_area`]] and do not works! But with default value works fine.
Friendly URLs are turned ON.
Hello All,
is there a update, fix or workaround to get the firstchildredirect working again in 2.1 rc3?