vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   How do I add the latest posts to my website homepage? (https://vborg.vbsupport.ru/showthread.php?t=129673)

FPR 10-22-2006 12:17 PM

How do I add the latest posts to my website homepage?
 
Looking to add the most recent forum posts to my homepage. Any ideas how?

Cheers
FPR

mescalin 10-27-2006 11:19 PM

i need that mod really urgent :(

sebbe 10-28-2006 12:56 AM

What type of homepage is it?

Assuming it's a non-vB one:
PHP Code:

$conn mysql_connect("localhost""username""password") or die(mysql_error());
$query "SELECT pagetext FROM post ORDER BY dateline DESC LIMIT 1";
$result mysql_query($query) or die(mysql_error());

while (list(
$pagetext mysql_fetch_array($result)))
{
    echo 
$pagetext;


Please note that this is the simplest possible way and will only output the latest post text and nothing else. You might have to add a table prefix also if you use any.

mescalin 10-28-2006 11:07 AM

thanks, i will try that..

but i couldnt understand why vb doesnt have a latest post mod, i was using invision and there were many mods for the same job. i have searched the forum many people are lookng for that but there isnt.. is editing vb harder than invision? :/

sebbe 10-28-2006 11:11 AM

I don't know if such a mod exist, but I would think that it's difficult to meet everyones needs, everone want the output in a different way.
Therefore, it's best to do this by your own. It's not very hard.

mescalin 10-28-2006 11:24 AM

i searched 3.6x mods but i couldnt find, its the most common mod in every forum sytem i hope there is one but i cant find.. Im not a coder so i cant write just waiting for a coder to develop it..:)

Thank you for your code again i will use that..

sebbe 10-28-2006 11:31 AM

What was that mod called on ipb? Maybe you can provide a link to it so I can see how it works?

Chicago_VLNU_4s 10-29-2006 12:24 AM

Quote:

Originally Posted by sebbe
What type of homepage is it?

Assuming it's a non-vB one:
PHP Code:

$conn mysql_connect("localhost""username""password") or die(mysql_error());
$query "SELECT pagetext FROM post ORDER BY dateline DESC LIMIT 1";
$result mysql_query($query) or die(mysql_error());
 
while (list(
$pagetext mysql_fetch_array($result)))
{
    echo 
$pagetext;


Please note that this is the simplest possible way and will only output the latest post text and nothing else. You might have to add a table prefix also if you use any.

doesnt work, it just displays that whole code on my homepage template

sebbe 10-29-2006 12:37 AM

Quote:

Originally Posted by Chicago_VLNU_4s
doesnt work, it just displays that whole code on my homepage template


You need to put "<?" or "<?php" around the code.
PHP Code:

<?
$conn = mysql_connect("localhost", "username", "password") or die(mysql_error());
$query = "SELECT pagetext FROM post ORDER BY dateline DESC LIMIT 1";
$result = mysql_query($query) or die(mysql_error());
 
while (list($pagetext = mysql_fetch_array($result)))
{
    echo $pagetext;
}
?>

Also, don't forget to change the strings "username" & "password" ;)

Chicago_VLNU_4s 10-29-2006 12:56 AM

sorry, still kinda new to this.. but what do you mean "change the strings" for username and password?

-thanks


All times are GMT. The time now is 04:22 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01120 seconds
  • Memory Usage 1,738KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete