IE:
"My offers" <- A page which has the following Ditto call;
<!-- This ditto call is on the page, and not in the template --> [[Ditto?! &dateSource=`pub_date` &dateFormat=`%b %d, %Y` &sortBy=`pub_date` &sortOrder=`DESC` &display=`all` &startID=`48` &summarize=`5` &paginate=`1` &paginateAlwaysShowLinks=`1` &tpl=`OfferList`]]
In the sidebar I would like to have an option to change the sortBy field to ’author’ or a template variable (ie: ’price’), or any other field I might want.
I’m wondering - is there a way to use a variable in a hyperlink to tell Ditto how to sort its pages, rather than creating yet another page? Can Ditto understand how to parse variables destined for the sortBy field?
ie:
[[Ditto?! &dateSource=`pub_date` &dateFormat=`%b %d, %Y` &sortBy=`{{SomeVariable}}` &sortOrder=`DESC` &display=`all` &startID=`48` &summarize=`5` &paginate=`1` &paginateAlwaysShowLinks=`1` &tpl=`VanList`]]
http://ditto.modxcms.com/extenders/request.html
[[Ditto?! &dateSource=`pub_date` &dateFormat=`%b %d, %Y` &sortBy=`pub_date` &sortOrder=`DESC` &display=`all` &startID=`48` &summarize=`5` &paginate=`1` &paginateAlwaysShowLinks=`1` &tpl=`OfferList` &extenders=`request` &id=`offer-list`]]
URL;
http://URL/PAGE/?ditto_id=offer-list&ditto_sortBy=tv_price&ditto_sortOrder=asc
In the wiki, it says to use a unique ID &id= however, if you use this it causes conflicts with pagination - sometimes pagination links completely disappear.
Quote from: worchyld at Feb 13, 2008, 09:47 AM
In the wiki, it says to use a unique ID &id= however, if you use this it causes conflicts with pagination - sometimes pagination links completely disappear.
When using &id and pagination you need to update your pagination placeholders to the format [+id_placeholder+].
Also, if you have &id and the request extender, the variables in the URL need to be in the format ditto_DITTOID_ instead of ditto_.
// This changes the sorting fine.
index.php?id=XX&ditto_id=vlist&ditto_vlist_sortBy=tv_price&ditto_vlist_sortDir=desc