ZenphotoCMS Forum
Random news links - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: Random news links (/thread-8410.html)



Random news links - jackdaw - 2011-03-26

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?




Random news links - acrylian - 2011-03-26

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.




Random news links - dps - 2012-03-12

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?




Random news links - acrylian - 2012-03-12

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.