need a bit, ok a lot, of help
trying to display recent posts of the forum onto my homepage
i've gotten this far
add before the html
<?php require("path/to/forum/SSI.php"); ?>
and then where I want it to display
<?php ssi_recentTopics($num_recent = 20, $exclude_boards = null, $include_boards = null, $output_method = 'echo'); ?>
so I mean, it works....
I have an error at the top of the page
Notice: Undefined index: googletagged in /forum/Sources/Subs.php on line 4707
and then
how do I format it to look better and how do I exclude boards... I see in the could exclude_boards but if I put the board numbers nothing displays, i tried
<?php ssi_recentTopics($num_recent = 20, $exclude_boards = (1,2,3,16,17), $include_boards = null, $output_method = 'echo'); ?>
http://askthemuslims.com/
thank you for your help
thank you but I'm not sure how to do that...
<?php
$data = ssi_recentTopics($num_recent = 20, $exclude_boards = array(1,2,3,16,17), $include_boards = null, $output_method = 'return');
var_dump($data);
echo ' <div> <a href="', $data.topic['last_post']['href'], '"><img src="', $data.settings['images_url'], '/icons/last_post.gif" alt="', $data.txt['last_post'], '" title="', $data.txt['last_post'], '" style="float: right;" /></a>', $data.topic['last_post']['anonymous'], '
', $data.topic['last_post']['time'], '<br />
', $data.txt['by'], ' ', $data.topic['last_post']['member']['link'], '</div>';
?>
gives all kinds of Warning: Illegal string offset errors
Why not just change the HTML in SSI.php so it echoes whatever markup you want? Then you don't have to mess with $data.
All it's doing by default is echoing this lot:
echo '
<table border="0" class="ssi_table">';
foreach ($posts as $post)
echo '
<tr>
<td align="right" valign="top" nowrap="nowrap">
[', $post['board']['link'], ']
</td>
<td valign="top">
<a href="', $post['href'], '">', $post['subject'], '</a>
', $txt['by'], ' ', $post['poster']['link'], '
', $post['is_new'] ? '<a href="' . $scripturl . '?topic=' . $post['topic'] . '.msg' . $post['new_from'] . ';topicseen#new" rel="nofollow"><img src="' . $settings['lang_images_url'] . '/new.gif" alt="' . $txt['new'] . '" /></a>' : '', '
</td>
<td align="right" nowrap="nowrap">
', $post['time'], '
</td>
</tr>';
echo '
</table>';
So you can change that to echo whatever divs/classes/etc suits your front page, as long as you keep the variables.
no... changing SSI itself is not a great choice.... it will get erased during upgrades and may conflict with mods.
Seriously -- writing the output into the format/layout you want is simple -- easier than modifying SSI
also, you can shorten the call...
$exclude_these = array(1,2,3,16,17);
$data = ssi_recentTopics(20, $exclude_these, null, 'return');
If it's simpler than rewriting a little bit of basic markup, it must be really simple.
I suggested rewriting a little bit of markup because the supposedly simpler way seemed to have not been explained in a way that was not confusing.
Basically, it's the same thing, without editing the core SSI file.
If he takes the code that you posted. Using $data_bit instead of $post, it will work...
foreach($data as $data_bit)
echo ' ........
...
...
...
';
Ok, so something like this?
foreach($data as $data_bit)
echo '
<ul class="custom_list_with_awesome_eye_candy">
<li>
', $data_bit['board']['link'], ']
</li>
<li>
<a href="', $data_bit['href'], '">', $data_bit['subject'], '</a>
</li>
<li>
', $txt['by'], ' ', $data_bit['poster']['link'], '
</li>
<li>
', $data_bit['is_new'] ? '<a href="' . $scripturl . '?topic=' . $data_bit['topic'] . '.msg' . $data_bit['new_from'] . ';topicseen#new" rel="nofollow"><img src="' . $settings['lang_images_url'] . '/dancing_bananas.gif" alt="' . $txt['new'] . '" /></a>' : '', '
</li>
<li>
', $data_bit['time'], '
</li>
</ul>';
And where do you stick that if you're not hacking SSI.php? Just throw it in any old front page template?
yes... put it in any other file/location....
This is easier than editing SSI directly because it means that you're not editing core files and it will be preserved during an upgrade (probably even across major versions)
was typing from my phone last night, but to anyone copying that code - don't forget the SSI call itself
(think you also had a rogue square brace in the first li....)
<?php
require_once('path/to/forum/SSI.php');
$exclude_these = array(1,2,3,16,17);
$data = ssi_recentTopics(20, $exclude_these, null, 'return');
foreach($data as $data_bit)
echo '
<ul class="custom_list_with_awesome_eye_candy">
<li>
', $data_bit['board']['link'], '
</li>
<li>
<a href="', $data_bit['href'], '">', $data_bit['subject'], '</a>
</li>
<li>
', $txt['by'], ' ', $data_bit['poster']['link'], '
</li>
<li>
', $data_bit['is_new'] ? '<a href="' . $scripturl . '?topic=' . $data_bit['topic'] . '.msg' . $data_bit['new_from'] . ';topicseen#new" rel="nofollow"><img src="' . $settings['lang_images_url'] . '/dancing_bananas.gif" alt="' . $txt['new'] . '" /></a>' : '', '
</li>
<li>
', $data_bit['time'], '
</li>
</ul>';
?>
Yes I missed the square brace. I was just typing that off the top of my head in the edit box.
Handy stuff to know. Haven't ever played with SSI myself, but was curious.
thank you both :) I think I can play around with this now
question though, how to get the annoying error at the top of the screen to go away
Notice: Undefined index: googletagged in /forum/Sources/Subs.php on line 4707
bwahahahaha I just caught the danceing_banana.gif.... that would have been a riot if it had actually worked and I didn't catch it :D
:D Beware of any code I write when I'm just doing examples.
that googletagged error is from some mod that you have that is not coded correctly