• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 386
  • Last Modified:

How can set to display only 1 top news in the news ticker?

http://www.uscuniversityhospital.org/ This is done in Drupal 5.7.  I'm a .net developer and definitely not in my element here.  How can I change this news ticker to display only one top news item?  We want to put up an important notice here and we want to only have that news message displayed.   I can log in as an admin.  Thank you
0
lapucca
Asked:
lapucca
  • 5
  • 3
  • 3
  • +1
2 Solutions
 
Kevin CrossChief Technology OfficerCommented:
Until you get some true Drupal advice (i.e., I am NOT a Drupal Expert), you can see if you can just manage this from the MySQL database side by using ORDER BY DateAddedColumn DESC LIMIT 1 -- i.e., whatever column denotes when a news item was added or updated should be used in order by descending so that the top most record is the latest news article, then just use limit to get the top x records. From .NET, if you did any MS SQL queries, this would be like SELECT TOP 1 ... ORDER BY DateAddedColumn DESC. In MySQL, it just goes at the end, e.g., SELECT ... ORDER BY DateAddedColumn DESC LIMIT 1.

Good luck!
0
 
lapuccaAuthor Commented:
I search Drupal category but didn't find it.  Thank you for adding it.  Can yo move Drupal up as the primary zone?  Thank you.
I'm not sure this is MYSql issue but thank you for the suggestion.
0
 
Kevin CrossChief Technology OfficerCommented:
Yes, I figure there must an easier way to configure this in Drupal itself. If all else fails, I did find this in the newsticker.module:

$result = db_query('SELECT ntid, weight, title, link FROM {newsticker_item} ORDER BY weight');

Open in new window


It is in two places I believe: newsticker_items_list() and newsticker_get_rotator(). The latter is actually shorter version as it just gets the title and link.

$result = db_query('SELECT title, link FROM {newsticker_item} ORDER BY weight');

Open in new window


Other code appears to be for INSERT, DELETE, and UPDATE operations on the newsticker items. Anyway, it appears WEIGHT is what controls the order in which these are displayed and not a date. So the lower weight shows first and then rotates through. Not sure you would want to limit this by the highest or lowest weight if only pulling 1 news item, but appears that is the default. Adding LIMIT 1 after ORDER BY weight in both queries should do what you want. Again, this is if you get in a bind.

If you just want to say grab a random newsticker, then you can try something like:

$result = db_query('SELECT ntid, weight, title, link FROM {newsticker_item} ORDER BY RAND() LIMIT 1);

Open in new window


Same thing for the other code. Maybe once installed, the module is configurable through Drupal. If not, you have to find the PHP code for the ticker or update in the .module file, then re-install newsticker. Just be careful of updates as it may overwrite your customization.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
HagayMandelCommented:
It seems that the news ticker is a Drupal's  'view'.
If so go to admin/build/blocks, and check which block is positioned at the header region.
Go to admin/build/views, and look for the specific 'view' in the list and edit it.
in "Basic settings" at "Items to display" select 1.
In "Sort criteria" select node ID and "descending"
This should do it.
0
 
lapuccaAuthor Commented:
Mw, is newsticker.module the name of the php file?  there are lots of file for this site and i only get FTP into the drive so it's hard for me to find where that file is. But thank you for your help.

Ha, I found the header view is "uscuh" but then in the View I cannot find that view to edit.  Can you have a look at the screen shots and let me know if you can see which view I'm to edit?  Thank you.
Blocks-1318081059615.jpeg
Administer-views-1318081630829.jpeg
0
 
junipllcCommented:
HagayMandel for the win.
0
 
HagayMandelCommented:
I guess that the scientific_papers_news view is the one to edit.
If i counted well, the number of item to display is 5; change it to 1
0
 
lapuccaAuthor Commented:
I thought the same thing since that's the only view with "homepage" keyword.  I didn't find anything that has number 5 or indicate it's news.  I attached a screen shot for your review.  Also, I don't know if this matters but on the top of the home page, PressRoom, is where all the news are.  The news ticker pulls the top 5 news from there.  

I really appreciate help with this.  We lost our PHP Drupal person and still hasn't found a replacement.  If I can't figure out how to do this then I'll have to do something ugly like creating 5 top news to be exactly the same so it keeps displaying the news title. We have an important news that needs to be up by Monday morning and stay there for a few days.
Edit-view-scientific-papers-news.jpeg
0
 
Kevin CrossChief Technology OfficerCommented:
I thought the view option to change would be your best bet, but since you asked -- yes, the .module file appears to be the PHP code. However, when you download newsticker, it is in a .module file. I would exhaust the GUI method first before customizing the PHP, but my changes should work if you can locate the file with the functions I noted.
0
 
HagayMandelCommented:
Look carefully in your screen shot, aside Nodes per Block: is is indicating 6.
Change it to 1.
(I'm sorry, it's Drupal 5, and I lack knowledge about this version).
0
 
lapuccaAuthor Commented:
I noticed the number 6 as well but I counted it before and it is only pulling top 5 news.  Anyway, I changed it to 1 just to make sure and that didn't affect the news ticker.  
0
 
lapuccaAuthor Commented:
Thanks.  I found it in the PHP file.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 5
  • 3
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now