• This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Latest posts on your website

I'm not ignoring this thread i just haven't had time to look into it, feel free to use other code with that attitude.

You haven't given me anything to work with, what you did to get the error, you haven't said if you have checked your error logs. Your now saying about someone else's code and yet complaining in my thread?
 
Can you please post the info you put into the script? So the url, the path etc that you set in the top of the code for me just to double check.

Also what does your log say exactly?
 
Also the same error

PHP:
<?php
// get latest x forum posts from xenforo v0.2 by liamdawe

// edit this to whatever folder your forum is in
$forum_url = '';

// change to the amount of posts you want displayed
$limit = 7;

// edit this to the directory your forum is in
$forum_directory = '/home/animelon/public_html/';

$startTime = microtime(true);

require($forum_directory. '/library/XenForo/Autoloader.php');
XenForo_Autoloader::getInstance()->setupAutoloader($forum_directory . '/library');

GeekPoint_Symfony::initializeXenforo($forum_directory, $startTime);

$nodeModel = XenForo_Model::create('XenForo_Model_Node');
$nodes = $nodeModel->getViewableNodeList();

$nodes_get = array_keys($nodes);

$node_id_list = implode($nodes_get, ',');

mysql_connect($config['db']['localhost'], $config['db']['xxxxxx'], $config['db']['xxx']);
mysql_select_db($config['db']['xxx']);

$sql_forum = "SELECT `title`, `thread_id` FROM `xf_thread` WHERE `node_id` IN ($node_id_list) ORDER BY `last_post_date` DESC LIMIT {$limit}";

$query_forum = mysql_query($sql_forum);
    while ($topics = mysql_fetch_assoc($query_forum))
    {
        $url_title = str_replace(' ', '-', $topics['title']);
        $url_title = str_replace('.', '', $url_title);
        $url_title = str_replace('?', '', $url_title);
        $url_title = str_replace('/', '-', $url_title);
        $url_title = str_replace('\\', '-', $url_title);
        $url_title = str_replace('"', '', $url_title);
        echo "<a href=\"{$forum_url}index.php?threads/{$url_title}.{$topics['thread_id']}/\">{$topics['title']}</a>";
    }
?>
 
I cannot get this to show up properly on my website, this is how it looks on my site:
* url snip *

This is the layout being used:
* snip *

Can anyone help me out here and take a look and see if you can see what I've got wrong please.
 
@ToDie4 you have saved your page in html format, it needs to be in php format.

@vodkaholic what is the error, neither of you have given me the actual error message. Also is your forum actually in the top level, not in a folder?
 
@ToDie4 you have saved your page in html format, it needs to be in php format.

Gah, that never dawned on me, now working lovely, thank you very much.

Would it be possible to display a sample of the thread content with the link saying 'read more'?
 
@
@vodkaholic what is the error, neither of you have given me the actual error message. Also is your forum actually in the top level, not in a folder?
My forum is in Root yes and error is the same "An unexpected error occurred. Please try again later."
nothing in xenforo log's tho
 
I just noticed you put "xxx" in the config vars (if you are hiding your actual details you put in), don't do that, the config vars are automatically set, so you are overwriting the config variables...with nothing.

That should fix it, as it would throw up an error since it cannot connec to the database :)
 
I just noticed you put "xxx" in the config vars (if you are hiding your actual details you put in), don't do that, the config vars are automatically set, so you are overwriting the config variables...with nothing.

That should fix it, as it would throw up an error since it cannot connec to the database :)
Same result mate
as

PHP:
mysql_connect($config['db']['localhost'], $config['db']['username'], $config['db']['password']);
mysql_select_db($config['db']['dbname']);
If this is what you mean

even
PHP:
$config['db']['host']
also
 
Yeah you need to keep them as that or else it really won't work.

Check your error logs on xenforo in the tools section, there should at least be something.
 
Yeah you need to keep them as that or else it really won't work.

Check your error logs on xenforo in the tools section, there should at least be something.
I have as above still the same mate (nothing in log's)

Edit this is the file
 

Attachments

Top Bottom