I use the Tx_news Extension (not TT_news) and have 2 pages where i show my newsitems. On Home I show only some topnews with the Listview, and there is a second page with the full News overview, the last one is ordered by Date & Time field.
But for the items on the Home I want a Manual sorting if it's possible.
I have added the following code in my resources:
$GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['orderByNews'] .= ",sorting";
This gives in the plugin the option for Manual Sorting, so that part works. Only How and Where can I order the News Items?
Note: I see in the Newsrecord table (tx_news_domain_model_news) the column sorting, my records are all 0 in there, I think its something with this, but can't get my finger on it.
I hope somebody can help me.
You need to set the news-plugin settings in ts-setup.
plugin.tx_news {
settings {
orderBy = sorting
orderDirection = desc
orderByAllowed = sorting,author,uid,title,teaser,author,tstamp,crdate,datetime,categories.title
}
}
Related
I am trying to display latest articles using views module. There are 12 article should be displayed per click of pagination excluding the duplicate entry. So, I tried as:
checked Advanced > Query settings > Distinct but no luck.
I have also tried as Views Distinct Settings > Filter/Aggregate this field > Filter Repeat, it works but number of articles are displayed less than 12.
Then, I tried to do it using the hook mymodule_views_query_alter but I do not understand how can I accomplish this task. I tried as:
if($view->current_display == "latest_article"){
$query->add_groupby('node.title');
}
But no solution. How can I override the query and inject DISTINCT function to get unique record.
Did you tried using Use aggregation option from Advanced section ? Hope this helps.
I am using osclass classified script, I want to get item id of the last item.
so far i tried following code but it do not work
$lastItem[] = View::newInstance()->_get('search_end');
echo $lastItem[0]['pk_i_id'];
anybody tell me whats wrong with it, or guide me to the right direction.
I believe you can use the latest items.
if (osc_has_latest_items()):
echo osc_item_id();
endif;
It uses the ::getLastestItems() method from the search model object that defaults to descending order. So the first item in the latest items list is actually the most recent.
However be advised that it will overwrite the 'standard' item loop, so don't use it within a while (osc_has_items()): for example.
I have a concrete5 site already using an autonav block in the global header for the main site navigation.
I now need to add a secondary navigation to the header containing different, less important links.
These links aren't necessarily to be shown in sitemap order, but I would prefer to use an auto-nav block if possible to do so.
Can anyone give me any tips on how to achieve this?
Can I get there somehow using Aliases on the sitemap?
Are you looking at using Bread Crumbs? We also use Mega Menu.. There are quite a few menuing systems from concrete5.org. Note: Mega Menu is not free, but is worth it.. The other thing is that sometimes the "File Tree" and "File Sets" may have to be re-ordered.. While in the file Tree, choose the option to update cache..
You should use a page attribute. You could use a checkbox for instance, call it secondary and if checked make your secondary nav to show it.
You can use a page list and an boolean attribute(for example: display_in_second_nav)
Here is an example:
$pl = new PageList();
$pl->filterByAttribute('display_in_second_nav');
$pages = $pl->get();
Also, you can sort results:
$pl->sortByRelevance()
Orders by index score descending. Only available when searching by keywords.
$pl->sortByDisplayOrder()
Orders by sitemap display order ascending.
$pl->sortByDisplayOrderDescending()
Orders by sitemap display order descending.
$pl->sortByPublicDate()
Orders by public date ascending.
$pl->sortByPublicDateDescending()
Orders by public date descending.
$pl->sortByName()
Orders by page name ascending.
$pl->sortByNameDescending()
Orders by name descending.
I just added price and sale_price attributes to my indexes in sphinx and it seemed like it was sorting just fine using, $s->SetSortMode(SPH_SORT_EXTENDED,'price desc');, however after a few pages the price shot back up again.
For instance, page one showed prices $1,000 - $800, page two showed prices $800 - $500, page three showed prices $500 - $200, then out of nowhere page four showed $300 - $100 or some random assortment of prices.
I'm wondering if sphinx is possibly still sorting by weight event though I haven't explicitly told it to... Does that sound like the problem?
I'm open to indulging any other ideas as well. Also, I definitely reindexed and rotated all indices and sphinx is not returning any errors.
Thanks in advance for your help.
Here are all the options I'm currently using: (update for #barryhunter)
$s->SetMatchMode(SPH_MATCH_BOOLEAN);
$s->SetSortMode(SPH_SORT_EXTENDED,'price desc');
$s->SetFilter("is_private", array(0));
$s->SetFilter("is_deleted", array(0));
$s->SetFilter("site_type", array(1));
$s->SetLimits($start, $count);
The answer was suggested in a comment by #barryhunter!
I added a new integer col to mysql called sort_price and filled it with (price * 100).
I then added that col as sql_attr_uint in sphinx and the sorting works perfecto!!
$s->SetSortMode(SPH_SORT_EXTENDED,'sort_price desc');
Thanks Barry :)
At a guess, are you using a Group-By?
If so, then SetSortMode does NOT set the order of the final results. The third param to setGroupBy does instead.
read the documentation on Group by to see how the two sort orders work.
Otherwise what column type do you store the price? Maybe its not getting converted to sphinxes float type correctly.
I have mysql_query problem in php. Of course I have visitors in my website and they read football news there. The problem is that I try to sort news by views DESCending, but it doesn't work for new uploaded news. Somehow it appears at the end of the page. I've figured out one more thing that when views of the news is 9 it appears at the beginning of the page, but if it is more than 9 it appears at the end of the page. I'd appreciate any kind of help. Here is mysql_query.
mysql_query("SELECT * FROM news ORDER BY views DESC");
Oh and by the way, my website is http://www.bbcsport-football.com/football
there you can find Sorting options, New and Most Viewed. Click most viewed and you'll see it.
You need to convert the views column to a number
mysql_query("SELECT * FROM news ORDER BY cast(views as INTEGER) DESC")
Or even better change the table definition so views is a INTEGER
You're sorting the news by the count of "views", if I'm right, views is the count of users that already have read the page right? Try sorting it by the publication date instead, like:
"SELECT * FROM news ORDER BY pub_date DESC"
your code seems to be o.k to me... just check this query in your phpmyadmin database and check results what you get manually.
i see your URL and it looks o.k as per order by view. but one thing i notice is your pagination.
when i click pagination (page 2) from most viewed. it will automatically redirected to the first page of new. hope this little testing will help you in your website.. :)