• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.5 Custom PHP page to render 5 latest posts from specific Forum or Category

#1
I wasn't quite sure the exact place to put this so if anyone knows a better forum, you can feel free to move it to the correct forum. My question that I would like help with is this.

I want my main PHP page that Xenforo is a subdomain of to read the MySQL database for my forums, and using the category or forum of my choosing, display the latest 5 threads from that forum on the main page of my website, (My website does not use any CMS system, it is HTML with PHP includes.) and to display it using my main sites css to display it how I want.

I want it to display

The thread title, avatar, who posted it, the date and the main message body.

AN example of my "news" layout is:

HTML:
<div class="newsMain">
<div class="newsWrap">
<div class="newsAvatar">
<img src="avatarlocation.jpg" alt="Avatar">
</div>
<div class="newsTitle">Hyperlinked Post Title</div>
<div class="newsMeta">Posted by <a href="forums.tld.com/userprofile">Poster</a> - on DATE
</div>
<div class="newsBody">Thread Body</div>
</div>
</div>


Below is an example of my main pages CSS that I would like the "news" to emulate

Code:
.newsMain {
        background-image:url('../img/themes/footer.jpg');
        background-repeat:repeat-x;
        height: auto;
        width: 610px;
        margin-left: -5px;
}
.newsWrap {
        width:100%;
        height:55px;
}
.newsAvatar {
        float:left;
        background-color:#000;
        height:48px;
        width:48px;
        border:2px solid #111;
}
.newsTitle {
        font-family: 'Trebuchet MS', Helvetica, sans-serif;
        padding:2px 0px 0px 54px;
        font-size:26px;
        font-weight:bold;
        height:32px;
}
.newsTitle a:hover {
        color:#DDD;
        text-decoration:none;
}
.newsMeta {
        padding:2px 0px 0px 54px;
        font-size:10px;
}
.newsBody {
        padding:5px 6px 6px 6px;
        height: auto;
}


Back in the day when I used SMF as my primary forum software, I used the SSI Includes and sculpted it how I needed. As I have been using Xenforo for a few years now I figured it would be time to set it up how I need it.

I would appreciate any prompt feedback and anyone wishing to give me a hand with this.
 
#2
I was just curious if anyone had any ideas on how I could achieve this or if they could please point me in the right direction....
 

Brogan

XenForo moderator
Staff member
#3
I want my main PHP page that Xenforo is a subdomain of to read the MySQL database for my forums, and using the category or forum of my choosing, display the latest 5 threads from that forum
It's going to require custom development.

If you aren't proficient in PHP and MySQL, you can look for an add-on, if one exists, otherwise you will need to contract a developer.