headlines on frontpage ?

Started by Floyds, March 15, 2004, 08:56:25 AM

Previous topic - Next topic

Floyds

Is there already a mod or trick to display headlines on a site frontpage. ??
(just one line (the topic line) and can it be made clickable)??


pulpitfire


Floyds

How can I make it work, I only want to show the topic and not the topicmessage??

pulpitfire

well, maybe something like this would work:

<? include("http://www.simplemachines.org/community/SSI.php?ssi_function=boardNews;board=X;limit=X;start=9999"); ?>

replace X with the board number and number of topics you want.  the "start=" sets the character off-set.  if you set it really high, it shouldn't show anything for that.  there may be a better way.

Floyds


pulpitfire


Floyds

Well this ;

Notice: Undefined index: icon in /home/alliedassault.nl/html/yabbse/SSI.php on line 1292

Notice: Undefined index: subject in /home/alliedassault.nl/html/yabbse/SSI.php on line 1292


Notice: Undefined index: time in /home/alliedassault.nl/html/yabbse/SSI.php on line 1292
by
Notice: Undefined index: poster in /home/alliedassault.nl/html/yabbse/SSI.php on line 1292




Notice: Undefined index: body in /home/alliedassault.nl/html/yabbse/SSI.php on line 1295




Notice: Undefined index: link in /home/alliedassault.nl/html/yabbse/SSI.php on line 1298
|
Notice: Undefined index: new_comment in /home/alliedassault.nl/html/yabbse/SSI.php on line 1298

And I have set the value to : start=1000

pulpitfire

did you do step 1?

News Scripting for SMF 1.0
Copyright (C) 2002-2004 Simple Machines Team. All Rights Reserved.
Web: http://www.simplemachines.org/


1. Setup the include statement on the page you wish your news to appear on according to the type of file you will be using. (either PHP or SHTML) For this case, we are going to show you how to do it through PHP includes. Add the include to point to SSI.php in your root SMF directory.

Eg. <? include("http://www.simplemachines.org/community/SSI.php"); ?>

2. Add the ?ssi_function=boardNews;board=n to the end of the URL above. Make sure you replace the n with the board number you want news to appear from.

Eg. <? include("http://www.simplemachines.org/community/SSI.php?ssi_function=boardNews;board=9"); ?>

That is all you need to do to get your basic script running. You can add any of the following to the end of that, but make sure you put a semilcolon (;) at the end of each variable. These variables aren't needed, but provide better versatility.

limit=n
Limits the amount of news items to show. (the default is 5)

length=n
Limits the length of each post to n characters. (the default is to impose no limit)

start=n
Starts the news items at a certain offset. (the default is 0)

Eg. <? include("http://www.simplemachines.org/community/SSI.php?ssi_function=boardNews;board=9;limit=7"); ?>
This shows an example of how one might change the limit on the news items.

Floyds

yes, and I have try to change the start=xxx but that doesn't do the trick.
I think I have to wait for someone to make a mod for it...

Thx.. anyway..

[Unknown]

Maybe if the start was at 0?

Why are you starting it off at 1000?

-[Unknown]

pulpitfire

#10
i'm not familiar enough yet, with the new system, to know the best way to do it.  but, it isn't too hard to write the code that does what you want.  you could do something like:



$limit = ;

echo '
<table cellpadding="0" cellspacing="0">

$request = mysql_query("SELECT ID_MSG,ID_TOPIC,subject,posterName,posterTime{$db_prefix}messages ORDER BY posterTime DESC LIMIT $limit");

$row = mysql_fetch_array($request);

while ($row = mysql_fetch_array($request)){
echo '
  <tr>
      <td valign="top" style="padding-top: 2px"><font size="1" color="red">&bull;</font></td><td  style="text-align: justify">
<a class="news7" href="' . $scripturl . '/t' . $row3['ID_TOPIC'] . '#msg' . $row3['ID_MSG'] . '">' . $row['subject'] . '</a>
     </td>
</tr>';
}

echo '
</table>';


of course, you may want to tweak or change some of that.

Floyds

oeps  ::) your losing me here,, I'm  not of a coder my self so I don't know how to write a script..

pulpitfire

ok, yeah.  i'll probably have to let someone more familiar with the new system offer a tip :).

[Unknown]

This works fine:

http://www.alliedassault.nl/yabbse/SSI.php?ssi_function=boardNews;board=29

Therefore, this should too:

<?php

require_once('/home/alliedassault.nl/html/yabbse/SSI.php');

$array boardNews(29100100'array');



At this point, you have an array of the topics... you want just the topics, and not the messages, right?


foreach ($return as $news)
echo '
', $news['subject'], ' - ', $news['link'], '<br />';


Bam, done ;).

-[Unknown]

Floyds

And can you tell me where what goes ??


[Unknown]

In your front page.

-[Unknown]

Floyds

MM I got an error.. ;Fatal error: Call to undefined function: boardnews() in /home/alliedassault.nl/html/lay.php on line 5

Here is snip of the frontpage code

<?php

require_once('/home/alliedassault.nl/html/yabbse/SSI.php');

$array boardNews(29100100'array');

foreach (
$return as $news)
echo '
'
$news['subject'], ' - '$news['link'], '<br />';
?>

<html>

<head>
<meta http-equiv="Content-Language" content="en-us">


Or is this wrong...

[Unknown]

Oops, typo... too many posts... must not go insane.

Change boardNews to ssi_boardNews.

-[Unknown]

Floyds

well I still getting a error...

Warning: Invalid argument supplied for foreach() in /home/alliedassault.nl/html/lay.php on line 7

Please tell me if this is richt. ?

(code) lay.php
<?php

require_once('/home/alliedassault.nl/html/yabbse/SSI.php');

$array = ssi_boardNews(29, 10, 0, 100, 'array');

foreach ($return as $news)
      echo '
         ', $news['subject'], ' - ', $news['link'], '<br />';
?>
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">

(Code)

meitzi

I don't know if this is what you are trying to do. But I needed to increase the amount of topic headers on my frontpage, and if I tryed to do that with ssi.php it gave an error if there was a message on "non puplic"-area.

Instead of that i opened my Recent.php at sources and searched for string "function GetLastPosts($showlatestcount = 5)" and simply replace 5 with 15.

Now at the frontpage there are links to 15 last posts on the forum.

I also needed to increase latest 10 messages to 25, it was done from the same recent.php

Advertisement: