Member
Member
jackdaw   2011-03-26, 13:58
#1

I asked this before, forgot it, and now have the same question again from someone whose site I'm maintaining. A list of random links to older news items. Same idea as random images, but now for news posts. I can't do it myself, but perhaps there is someone who could modify the printLatestNews() function into printRandomNews() to create a list of lets say three links?

Administrator
Administrator
acrylian   2011-03-26, 14:13
#2

You can do that with a quite simple mysql query:
$randomnews = query_full_array( "SELECT titlelink FROM ".prefix('news')." ORDER BY RAND() LIMIT 3")
Then use the object model with the result array to print the actual stuff you need.

Member
Member
dps   2012-03-12, 09:12
#3

Well! I want select only news from a given category, like "tip of the day", I must write a clause "WHERE ...". May you help me?

Administrator
Administrator
acrylian   2012-03-12, 11:18
#4

No, categories are stored in the table news_categories and the assigment within news2cat. Use the object model to get articles from a category. Please see the documentation.

  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.