Hi, I have a news page with a list of news items, if you click a news item it will show on the detail area of the page. This works perfectly however I would like to always display the latest news item in the detail area when the page loads, before anything is selected. This is my page so far: http://gloom.band/news.php
Hi, it’s the same query. There are no restrictions on the page, however it is not a secure page.Try www.gloom.com.au and click on the news link for the same pge.
To get the last record i would normally just use a query sorted on the news_date descending so the last record is first and then use a LIMIT 1 clause to only select the last record. The query is simple however i have no idea off the top of my head how to set a LIMIT clause in Wappler but i am sure someone will.
The paged query set to 1 will work to always display the latest news item by default on page load, but after that I want people to be able to click on headlines and show the news in the same detail area. At the moment I have it set to show if there is a value for the news id, so it is blank on page load. Do you think a conditional show/hide somehow to show the news in the same area?
Thanks for all your replies and advice,much appreciated. AJ
This is not tested but think it will work.
1.You can create a cookie named ‘paging’
2.Initially set it as value=1 and when the user clicks on any of the other links set it to 15
3.Also set the paging to be shown when the cookie value > 1
This way it won’t display when you only show the first item
Thanks, that would probably work, but I did it a simpler way, using the paged query limit 1 as suggested, and duplicating the detail region, however hiding the second detail region when a value of news_id is present, so showing when none is selected. Works like a dream, thanks everyone for the help.