The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Getting the latest Article to display
So I'm trying to use one of the modules on my home page to list the latest article that has the tag 'spotlight' in it. Will only display the latest one, not all of them. I've no idea where to even start. I haven't figured out how to edit modules themselves yet, but I imagine I can find what I'm looking for in the 'Slider' Module.
Any hints on where or how would be awesome. You can almost do this with the Search Module. Using JSON: {"tag":["spotlight"],"channel":["13"],"sort":{"created":"desc"},"view":null,"exclude_ty pe":["vBForum_PrivateMessage"]} Can't figure out what possible views other than compact, and topic. If there was a full, or post (Yes I tried those) and it showed the full article. That would have been awesome so there has to be another way. |
#2
|
||||
|
||||
You can use PHP module and do a search with that JSON criteria. You can style it the way you want to.
|
#3
|
|||
|
|||
Glenn,
Thanks for the quick response as always. I'm lost on how I can get it to search and display the data in a PHP though. I can get the search function to find it properly, but I can't get it to display just the entire article without the click more. |
#4
|
||||
|
||||
So you are saying your aren't familiar with how to write PHP/MySQL code to do this or that you don't know the exact query because you are unfamiliar with the database schema?
|
#5
|
|||
|
|||
I could run the queries to show but then I have BB code through out. Is there a way to parse this to HTML?
|
#7
|
|||
|
|||
TY, that's what I needed to know!
--------------- Added [DATE]1475776484[/DATE] at [TIME]1475776484[/TIME] --------------- For anyone that comes to this page looking for answers. You can open a PHP Module. I wanted mine to be displayed in a max height of 800px. You can change that to what you want or remove it. In the Query if you do not wish to have a taglist search. Just remove : 'AND taglist LIKE '%spotlight%'' You'll also need to know the nodeid for articles. Mine is 13. Change 13 to whatever your article nodeid is. You can find them in the channel manager. Put the following code: Code:
global $vbulletin; echo "<div style='height: 800px; max-height: 800px; overflow: auto;'>"; $result = $vbulletin->db->query("SELECT nodeid FROM " . TABLE_PREFIX . "node WHERE parentid = 13 AND taglist LIKE '%spotlight%' ORDER BY created DESC LIMIT 1"); if ($row = $result->fetch_assoc()){ echo vB5_Frontend_Controller_Bbcode::parseNodeText($row['nodeid']); }else{ echo "<div style='text-align: center; padding: 10px;'><h2>Could not find any articles using tag 'spotlight'</h2></div>"; } unset($row); unset($result); echo "</div>"; |
#8
|
||||
|
||||
You will also need to add the table prefix (if any). This is not required if the TABLE_PREFIX global variable is added in the query.
Code:
"SELECT nodeid FROM " . TABLE_PREFIX . "node ...."; Code:
max-height: 800px; Code:
max-height= 800px; |
Благодарность от: | ||
Lynne |
#9
|
|||
|
|||
You are correct sir. I edited the post to use your changes.
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|