Hello guys, I need help with this. How can I only show something in the front page?
this is a example:
if ($url == '/index.php'){
echo 'hello world';
}elseif($url == '/index.php?board=4.0'){
echo 'Hello night';
}
Where exactly do you want to put this content? (it matters relative to the front page listing)
Also are you using any of the portal mods?
What is it that you are trying to show on the front page? You could simply add it is to the board index.template.php. Or if using a portal mod you could make a custom block and set it to only show on the board index.
EDIT : Arantor beat me to it lol
Quote from: Arantor on May 20, 2024, 04:51:03 PMWhere exactly do you want to put this content? (it matters relative to the front page listing)
Also are you using any of the portal mods?
Quote from: TwitchisMental on May 20, 2024, 04:52:29 PMWhat is it that you are trying to show on the front page? You could simply add it is to the board index.template.php. Or if using a portal mod you could make a custom block and set it to only show on the board index.
EDIT : Arantor beat me to it lol
I want to add a list of topics on the top of boards, but it's show on every page as topics or user page.
But, To be clear the code you have proposed will not do it.
Where did you add that code?
And, please answer the other questions
Quote from: Kindred on May 20, 2024, 05:12:30 PMBut, To be clear the code you have proposed will not do it.
Where did you add that code?
And, please answer the other questions
This is something I want to on the front page:
require_once('SSI.php');
$PostList = ssi_recentTopics(8, null, null, 'array');
foreach ($PostList as $Post) {
echo "<tr>";
echo "<div class='forum_posts'>";
echo '<br><td width="350px"><a target="_blank" href=', $Post['href'], '>', $Post['subject'], '</a></td>',
'<td width="350px"><a target="_blank" href=', $Post['href'], '>', $Post['board']['id'], '</a></td>',
'<td width="250px"><a target="_blank" href=', $Post['board']['href'], '>',$Post['board']['name'],'</a></td>',
'<td width="100px"><a target="_blank" href=', $Post['poster']['href'], '>', $Post['poster']['name'], '</a></td>',
'<td width="150px">',$Post['time'],'</td>';
echo "</div>";
echo "</tr>";
}
unset($PostList);
}
I only want to show on front page, I added in index.template.php
Well, first things first, index.template.php is on every page - if you want it on the board index, put it in Boardindex.template.php which is the template for the front page.
Secondly, you're not *really* supposed to use SSI.php inside SMF itself. Yes, it'll work, but it will likely introduce other issues. A better solution is to actually use one of the portal mods which come with a recent topics block to put at the top on any page you want.
Also, forcing a pixel width like that is so 10 years ago... it's bad coding in current designs. Plus, I see tr and td, but no table...
But then again, using a table for layout is also last decade
It's literally tabular data though.
Quote from: Arantor on May 21, 2024, 04:24:28 AMIt's literally tabular data though.
I guess it COULD be considered tabular data... :P
Quote from: Arantor on May 20, 2024, 06:42:43 PMWell, first things first, index.template.php is on every page - if you want it on the board index, put it in Boardindex.template.php which is the template for the front page.
Secondly, you're not *really* supposed to use SSI.php inside SMF itself. Yes, it'll work, but it will likely introduce other issues. A better solution is to actually use one of the portal mods which come with a recent topics block to put at the top on any page you want.
Thanks! all set. I have another question. Could I pull the user avatar from SSI.php?
Pretty sure it doesn't support avatars, and even if it did, you're still not *really* supposed to be using it like that...
Quote from: Arantor on May 21, 2024, 12:51:27 PMPretty sure it doesn't support avatars, and even if it did, you're still not *really* supposed to be using it like that...
Thanks. I really appreciate it.
Ti reiterate what arantor said... don't use SSI within existing forum template files. Really. Don't do that.
There are other, better ways to do what you are looking to do without purposefully misusing the scripts