SimplePortal

Customization => Custom Coding => Topic started by: bizref on September 07, 2008, 11:34:01 AM

Title: Link to Forum inside of a Block
Post by: bizref on September 07, 2008, 11:34:01 AM
Could somebody help me with how I could add a

"Click For All Topics ..." instruction and link beneath the list of "Popular Topics" as part of the same block?

To be clear, Popular Topics would show the list of (parameter) most popular topics, and then centered beneath that list (or right justified) would be the link called "Click To View All Topics"

I think that would be a great way to bring people into the forum ...!

Thanks for your help!!!!  (I'm a newbie non-coding moron so remedial explanation would be much appreciated)
Title: Re: Link to Forum inside of a Block
Post by: ccbtimewiz on September 07, 2008, 12:17:22 PM
Well, exactly where would it take you? The board index?
Title: Re: Link to Forum inside of a Block
Post by: bizref on September 07, 2008, 07:55:50 PM
Yes, exactly: it would bring the visitor into the board index...
Title: Re: Link to Forum inside of a Block
Post by: bizref on September 12, 2008, 01:26:54 PM
Anybody?  Any thoughts?  Thanks so much!
Title: Re: Link to Forum inside of a Block
Post by: Nathaniel on September 12, 2008, 08:01:26 PM
Find this code ('sources/Sportal.php'):
Code: [Select]
echo '
<table border="0" width="100%" class="ssi_table">';
foreach ($posts as $post)
echo '
<tr>
<td align="center" valign="middle" nowrap="nowrap">
', $post['icon'], '
</td>
<td valign="top" width="%100">
<a href="', $post['href'], '">', $post['subject'], '</a>
', $post['new'] ? '' : '<a href="' . $scripturl . '?topic=' . $post['topic'] . '.msg' . $post['new_from'] . ';topicseen#new"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" alt="' . $txt[302] . '" border="0" /></a>', '<br />[', $post['board']['link'], ']
</td>
<td align="right" nowrap="nowrap">
', $post['poster']['link'], '<br />', $post['time'], '
</td>
</tr>';
echo '
</table>';

Replace with this code:
Code: [Select]
echo '
<table border="0" width="100%" class="ssi_table">';
foreach ($posts as $post)
echo '
<tr>
<td align="center" valign="middle" nowrap="nowrap">
', $post['icon'], '
</td>
<td valign="top" width="%100">
<a href="', $post['href'], '">', $post['subject'], '</a>
', $post['new'] ? '' : '<a href="' . $scripturl . '?topic=' . $post['topic'] . '.msg' . $post['new_from'] . ';topicseen#new"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" alt="' . $txt[302] . '" border="0" /></a>', '<br />[', $post['board']['link'], ']
</td>
<td align="right" nowrap="nowrap">
', $post['poster']['link'], '<br />', $post['time'], '
</td>
</tr>';
echo '
</table><a href="', $scripturl, '?action=forum">Click To View All Topics</a>';
Title: Re: Link to Forum inside of a Block
Post by: bizref on September 13, 2008, 08:08:33 PM
Thank you for the detail, followed instructions exactly but am not seeing the link show up ... this is for the Top Topics block?  Thanks again!
Title: Re: Link to Forum inside of a Block
Post by: Nathaniel on September 13, 2008, 10:28:41 PM
Sorry, that edit was for the wrong block. Try undoing that edit and then performing the edit below:
Find this code:
Code: [Select]
echo '
<table class="ssi_table">
<tr>
<th align="left">', $txt['sp-ttopicname'], '</th>
<th align="left">', $type ? $txt[301] : $txt[110], '</th>
</tr>';
foreach ($topics as $topic)
echo '
<tr>
<td align="left">
', $topic['link'], '
</td>
<td align="right">', $type ? $topic['num_views'] : $topic['num_replies'] , '</td>
</tr>';
echo '
</table>';

Replace with this code:
Code: [Select]
echo '
<table class="ssi_table">
<tr>
<th align="left">', $txt['sp-ttopicname'], '</th>
<th align="left">', $type ? $txt[301] : $txt[110], '</th>
</tr>';
foreach ($topics as $topic)
echo '
<tr>
<td align="left">
', $topic['link'], '
</td>
<td align="right">', $type ? $topic['num_views'] : $topic['num_replies'] , '</td>
</tr>';
echo '
</table><a href="', $scripturl, '?action=forum">Click To View All Topics</a>';
Title: Re: Link to Forum inside of a Block
Post by: bizref on September 18, 2008, 08:32:03 PM
Thanks -- I guess my reply got lost during the server outage so I can't tell you exactly what the error was, but when I applied the revised code I got an error about "parsing error" and "an unexpected ">" was discovered in line 990 .. So I tried to return to the original code and continued to get the error, except in line 988 ...

I don't want to repeat the process because my site is live and this error brought it down.  Would you mind double checking the code and parsing for me?

Thanks!
Title: Re: Link to Forum inside of a Block
Post by: Nathaniel on September 19, 2008, 04:22:53 AM
That edit should work. Can you please post your 'SPortal.php' file so that I can check the php parse error?
Title: Re: Link to Forum inside of a Block
Post by: bizref on September 20, 2008, 09:38:17 AM
Hmm ... it's too long to post here, maybe I misunderstood your request?  :-[  May I email it to you?
Title: Re: Link to Forum inside of a Block
Post by: [SiNaN] on September 20, 2008, 09:52:24 AM
You can attach it here, I guess.
Title: Re: Link to Forum inside of a Block
Post by: bizref on September 20, 2008, 10:05:25 AM
I can't see how to attach a file to the post ..?  :-[ :-[ :-[ :-[ :-[
Title: Re: Link to Forum inside of a Block
Post by: Cyst on September 20, 2008, 02:22:03 PM
It should be under 'Additional Options...' when you're in reply mode :)
Title: Re: Link to Forum inside of a Block
Post by: bizref on September 20, 2008, 03:42:44 PM
Thank you, I didn't even know to look there!!

Sportal.php now attached :-)
Title: Re: Link to Forum inside of a Block
Post by: Nathaniel on September 21, 2008, 08:20:58 PM
I have applied the edit to that file. It should work now. ;)
Title: Re: Link to Forum inside of a Block
Post by: bizref on September 21, 2008, 09:43:19 PM
Thanks a million!  I uploaded it but nothing has changed, do I need to re-create the block?
Title: Re: Link to Forum inside of a Block
Post by: Nathaniel on September 21, 2008, 09:45:31 PM
No it should work automatically. I may have changed the wrong block type. Are using the "Top Topics" type or a different one?
Title: Re: Link to Forum inside of a Block
Post by: bizref on September 24, 2008, 03:32:44 PM
I'm using the "Top Topics" block ... I've set up 2 or 3 Top Blocks and it's not showing up ...?
Title: Re: Link to Forum inside of a Block
Post by: ???1031 on September 25, 2008, 12:31:34 AM
Can i've a link to you forum? I would like to see the posts that you use =).

I saw the file i it look good to me.

Bye
DIN1031
Title: Re: Link to Forum inside of a Block
Post by: bizref on September 26, 2008, 11:06:12 PM
http://www.allaboutdarien.com/forum/index.php

There's the link ... the block in question is "Popular Topics" on the left, and then I created a new one called "Test 2" on the right ...

But I wouldn't mind also being able to include the link to the forum in other blocks as well ... would it be possible to make it a "permission," like the other permissions?  Then you could just select which blocks you'd like that link to be in ...?
SimplePortal 2.3.8 © 2008-2024, SimplePortal