News:

Wondering if this will always be free?  See why free is better.

Main Menu

Change layout-output of SSI BoardNews

Started by Crawler, April 09, 2007, 03:56:04 AM

Previous topic - Next topic

Crawler

I had the InvisionBoard 1.3 running for quiet a while now, but I will switch to SMF because of security-reasons. I only have one problem left: the IB had a very easy to modify template for the output of the ssi-data, in SMF I have to edit the SSI.php and I'm not good enough to do that. I want the output to look like the screenshot (it's just tables, but I don't know how to fit that into the php-file). Could some one please help me with that? If it works I want to put the latest 15 topics on my news-site.



By the way, here you can find the html-file (CSS, will be completly in an external file, I just hadn't the time to do that yet): http://www.nvinside.de/inhalt/ssi.htm [nofollow]

Daniel15

Quotein SMF I have to edit the SSI.php and I'm not good enough to do that
You can use the "array" output type to return an array, and then format the array however you want.

Here's an example of how to do that, using the HTML file you linked to above. Save this file into your SMF directory, with any filename (if you want to put it in a different directory, change the path to SSI.php).


<?php
require('SSI.php');
?>
<html><head>


<meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><title>NVinside.de News</title>

<link rel="stylesheet" type="text/css" href="nvinside_news.css">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

<style type="text/css">
.style1 {
font-weight: bold;
color: #FFFFFF;
}
.style2 {
font-size: 8pt;
}
</style>
</head><body>

<?php

// Get the latest news
$news_items = ssi_boardNews(1, 15, null, null, 'array'); // Board, Number of topics, topic to start at, length to get, return type
// Loop through all the items
foreach ($news_items as $news)
{
echo '
<div align="center">
<table style="border-collapse: collapse;" border="1" bordercolor="#c0c0c0" cellpadding="2" cellspacing="0" width="98%">
<tbody><tr>
<td bgcolor="#4963ad">
<table style="border-collapse: collapse;" border="0" width="100%">
<tbody><tr>
<td><b><font color="#ffffff"><a href="'
, $news['href'], '">', $news['icon'], '</a> <b>', $news['subject'], '</b></font></b></td>
<td nowrap="nowrap">
<p align="right"><span style="color: rgb(255, 255, 255); font-weight: 700;">
gepostet von </span>
<a href="'
, $news['poster']['href'], '">
<span class="style1">'
, $news['poster']['name'], '</span></a><b><font color="#ffffff">
am '
, $news['time'], '</font></b></p></td>
</tr>
</tbody></table>
</td>
</tr>
<tr>
<td>
<p align="justify">
'
, $news['body'], '<br><br>

<span style="font-size: 8pt;">
<a target="_blank" href="'
, $news['href'], '">
<font style="font-size: 8pt;">'
, $news['replies'], ' ', ($news['numReplies'] == 1 ? $txt['smf_news_1'] : $txt['smf_news_2']), '</font></a></span>
<span class="style2">'
, $news['locked'] ? '' : ' | ' . $news['comment_link'], '</span></p></td>
</tr>
</tbody></table>
</div>
<br>'
;
}
?>


:D
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

Crawler


Crawler

#3
I have one more question. How would I have to change the source code below, if I wanted to keep that layout, but wanted to add a col to the right in which I could put an ad-code for AdSense - I couldn't get it to work, because when I put the use in the left col and the add-code in the right one, the ad-banner shows up besides every posting, but I want it to appear just once at the top of the site - like this: http://board.nvinside.de/news1.htm [nofollow]

<?php
require('SSI.php');
?>
<html><head>


<meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><title>NVinside.de News</title>

<link rel="stylesheet" type="text/css" href="news.css">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

<style type="text/css">
.style1 {
font-weight: bold;
color: #FFFFFF;
}
.style2 {
font-size: 8pt;
}
</style>
</head><body>

<?php

// Get the latest news
$news_items = ssi_boardNews(20, 15, null, null, 'array'); // Board, Number of topics, topic to start at, length to get, return type
// Loop through all the items
foreach ($news_items as $news)
{
echo '
<div align="center">
<table style="border-collapse: collapse;" border="1" bordercolor="#c0c0c0" cellpadding="2" cellspacing="0" width="98%">
<tbody><tr>
<td bgcolor="#4963ad">
<table style="height: 20px" style="border-collapse: collapse;" border="0" width="100%">
<tbody><tr>
<td><b><font color="#ffffff"><a href="'
, $news['href'], '">', '</a> <b>', $news['subject'], '</b></font></b></td>
<td nowrap="nowrap">
<p align="right"><span style="color: rgb(255, 255, 255); font-weight: 700;">
gepostet von </span>
<a href="'
, $news['poster']['href'], '">
<span class="style1">'
, $news['poster']['name'], '</span></a><b><font color="#ffffff">
am '
, $news['time'], '</font></b></p></td>
</tr>
</tbody></table>
</td>
</tr>
<tr>
<td>
<p align="justify">
'
, $news['body'], '<br><br>

<span class="style2"><a target="_self" href="'
, $news['href'], '">
'
, $news['replies'], ' ', ($news['numReplies'] == 1 ? $txt['smf_news_1'] : $txt['smf_news_2']), '</a></span>
<span class="style2">'
, $news['locked'] ? '' : ' | ' . $news['comment_link'], '</span></p></td>
</tr>
</tbody></table>
</div>
<br>'
;
}
?>

Crawler

Could you please help me once more with the above?

Daniel15

#5
You could put the ad in a table, I guess...

From your code above...
Find:

</head><body>

Replace with:

</head><body>
<table>
<tr>
<td>


Find:

?>

Replace with:

echo '
</div>
<br>
</td>
<td style="width: 130px" valign="top">
Ad code here
</td>
</tr>
</table>';
?>


That should work :)
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

Crawler

Thx, but that doesn't give me the layout I wanted. Now it looks like this (http://board.nvinside.de/news_add.php [nofollow]), but it should look like this (http://board.nvinside.de/news1.htm [nofollow]).

Daniel15

Sorry, I made a mistake in my post above...
Here's the corrected bit:

Find:

?>

Replace with:

echo '
</div>
<br>
</td>
<td style="width: 130px" valign="top">
Ad code here
</td>
</tr>
</table>';
?>
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

Crawler

Thx, but now the add is a at the bottom of th page (http://board.nvinside.de/news_add.php [nofollow]) ...

Advertisement: