TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,004
  • Total Topics: 21,330
  • Online today: 468
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 179
  • Total: 179

SSI scripts (multiple) in a single block w/HTML

Started by layne, March 09, 2007, 09:32:19 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

layne

I'm trying to create a front page nav system that uses pictures that represent the main boards, and under those pics, i'd like to use the SSI recent topics script (the modified one that uses "Include" to limit it to certain boards) to show the 3 most recent topics for that particular board.  I'm trying to figure out how to get the HTML info to work in a php block.  I can't seem to get it to work right. I'm creating a new PHP page in dreamweaver and then designing a page that includes the PHP SSI info in the HTML tables. Will that work? Am i missing something? Sorry, I'm a bit of a newb to the whole coding thing. Here's my front page, so you can see the nav system, just imagine the SSI scripts under each picture: the last 3 topics for each board.

http://forum.vailchristian.com

layne

In fact here's the exact code i tried, and i can't figure out what's wrong with it, cause i'm such a newb.

<table width="638" border="0" align="center">
    <tbody>
        <tr>
            <td width="208" valign="top">
            <div align="center">
            <p><a href="http://forum.vailchristian.com/index.php?board=8.0"><img width="190" vspace="5" height="274" border="0" alt="" src="http://www.vailchristian.com/layne/faithandculture2.jpg" /><br />
            Broken people in a broken world.<br />
            Makes for great discussion.</a></p>
            global $context, $scripturl, $settings, $txt;
$bullet = '<img src="'.$settings['images_url'].'/TPdivider.gif" alt="" border="0" style="margin:0 2px 0 0;" />';

$result=ssi_recentTopics_Include(3,array(8),'return');

foreach($result as $my){
  echo "$bullet";
  echo '<span class="smalltext">'.$my['link'];

  // is this topic new? (assume they are logged in)
if (!$my['new'] && $context['user']['is_logged'])
        echo ' <a href="', $scripturl, '?topic=', $my['topic'], '.from', $my['new_from'], '#new"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" border="0" /></a>';
echo '<br />';
echo ' started by ', $my['poster']['link'];
echo '<br />';
echo $my['time'];
echo '<br />';

}
echo '</span>';</div>
            </td>
            <td width="208" valign="top">
            <div align="center">
            <p><a href="http://forum.vailchristian.com/index.php?board=9.0"><img width="190" vspace="5" height="274" border="0" alt="" src="http://www.vailchristian.com/layne/lifeandcommunity2.jpg" /><br />
            Life happens.<br />
            Talk about it here.</a></p>
            global $context, $scripturl, $settings, $txt;
$bullet = '<img src="'.$settings['images_url'].'/TPdivider.gif" alt="" border="0" style="margin:0 2px 0 0;" />';

$result=ssi_recentTopics_Include(3,array(9),'return');

foreach($result as $my){
  echo "$bullet";
  echo '<span class="smalltext">'.$my['link'];

  // is this topic new? (assume they are logged in)
if (!$my['new'] && $context['user']['is_logged'])
        echo ' <a href="', $scripturl, '?topic=', $my['topic'], '.from', $my['new_from'], '#new"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" border="0" /></a>';
echo '<br />';
echo ' started by ', $my['poster']['link'];
echo '<br />';
echo $my['time'];
echo '<br />';

}
echo '</span>';</div>
            </td>
            <td width="208" valign="top">
            <div align="center">
            <p><a href="http://forum.vailchristian.com/index.php?board=10.0"><img width="190" vspace="5" height="274" border="0" alt="" src="http://www.vailchristian.com/layne/artsandmedia.jpg" /><br />
            Music, movies, television,<br />
            theater, mime, etc...</a></p>
            global $context, $scripturl, $settings, $txt;
$bullet = '<img src="'.$settings['images_url'].'/TPdivider.gif" alt="" border="0" style="margin:0 2px 0 0;" />';

$result=ssi_recentTopics_Include(3,array(10),'return');

foreach($result as $my){
  echo "$bullet";
  echo '<span class="smalltext">'.$my['link'];

  // is this topic new? (assume they are logged in)
if (!$my['new'] && $context['user']['is_logged'])
        echo ' <a href="', $scripturl, '?topic=', $my['topic'], '.from', $my['new_from'], '#new"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" border="0" /></a>';
echo '<br />';
echo ' started by ', $my['poster']['link'];
echo '<br />';
echo $my['time'];
echo '<br />';

}
echo '</span>';</div>
            </td>
        </tr>
        <tr>
            <td width="208" valign="top">
            <div align="center">
            <p><a href="http://forum.vailchristian.com/index.php?board=11.0"><img width="190" vspace="5" height="274" border="0" alt="" src="http://www.vailchristian.com/layne/thelibrary.jpg" /><br />
            Books. What you're reading,<br />
            what you've read, discussions about, reviews of...</a></p>
            global $context, $scripturl, $settings, $txt;
$bullet = '<img src="'.$settings['images_url'].'/TPdivider.gif" alt="" border="0" style="margin:0 2px 0 0;" />';

$result=ssi_recentTopics_Include(3,array(11),'return');

foreach($result as $my){
  echo "$bullet";
  echo '<span class="smalltext">'.$my['link'];

  // is this topic new? (assume they are logged in)
if (!$my['new'] && $context['user']['is_logged'])
        echo ' <a href="', $scripturl, '?topic=', $my['topic'], '.from', $my['new_from'], '#new"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" border="0" /></a>';
echo '<br />';
echo ' started by ', $my['poster']['link'];
echo '<br />';
echo $my['time'];
echo '<br />';

}
echo '</span>';
</div>
            </td>
            <td width="208" valign="top">
            <div align="center">
            <p><a href="http://forum.vailchristian.com/index.php?board=12.0"><img width="190" vspace="5" height="274" border="0" alt="" src="http://www.vailchristian.com/layne/constantprayer.jpg" /><br />
            A place for prayer: requests, <br />
            praises, or online prayers<br />
            offered corporately.</a></p>
            global $context, $scripturl, $settings, $txt;
$bullet = '<img src="'.$settings['images_url'].'/TPdivider.gif" alt="" border="0" style="margin:0 2px 0 0;" />';

$result=ssi_recentTopics_Include(3,array(12),'return');

foreach($result as $my){
  echo "$bullet";
  echo '<span class="smalltext">'.$my['link'];

  // is this topic new? (assume they are logged in)
if (!$my['new'] && $context['user']['is_logged'])
        echo ' <a href="', $scripturl, '?topic=', $my['topic'], '.from', $my['new_from'], '#new"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" border="0" /></a>';
echo '<br />';
echo ' started by ', $my['poster']['link'];
echo '<br />';
echo $my['time'];
echo '<br />';

}
echo '</span>';</div>
            </td>
            <td width="208" valign="top">
            <div align="center">
            <p><a href="http://forum.vailchristian.com/index.php?board=1.0"><img width="190" vspace="5" height="274" border="0" alt="" src="http://www.vailchristian.com/layne/thecafe.jpg" /><br />
            Feel free to talk about anything<br />
            and everything here.</a></p>
            global $context, $scripturl, $settings, $txt;
$bullet = '<img src="'.$settings['images_url'].'/TPdivider.gif" alt="" border="0" style="margin:0 2px 0 0;" />';

$result=ssi_recentTopics_Include(3,array(1),'return');

foreach($result as $my){
  echo "$bullet";
  echo '<span class="smalltext">'.$my['link'];

  // is this topic new? (assume they are logged in)
if (!$my['new'] && $context['user']['is_logged'])
        echo ' <a href="', $scripturl, '?topic=', $my['topic'], '.from', $my['new_from'], '#new"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" border="0" /></a>';
echo '<br />';
echo ' started by ', $my['poster']['link'];
echo '<br />';
echo $my['time'];
echo '<br />';

}
echo '</span>';</div>
            </td>
        </tr>
    </tbody>
</table>

layne

#2
okay, so nevermind I figured it out. nothing like learning code through trial and error.  I hadn't added the <?php  ?> tags around the php SSI sections, and i also realized that there's probably a <?php included in the phpblock by default, so i just started my code with ?>. works like a charm. hope this helps someone else. here's the final code with a link:

http://forum.vailchristian.com

?><head>
<STYLE TYPE="text/css">
<!--
.indented
   {
   padding-left: 10pt;
   padding-right: 10pt;
   }
-->
</STYLE>
</head>
<table width="638" border="0" align="center">
    <tbody>
        <tr>
            <td width="208" valign="top">
            <div align="center">
            <p><a href="http://forum.vailchristian.com/index.php?board=8.0"><img width="190" vspace="5" height="274" border="0" alt="" src="http://www.vailchristian.com/layne/faithandculture2.jpg" /><br />
            Broken people in a broken world.<br />
            Makes for great discussion.</a></p>
            <p align="left" class="indented"><?php global $context$scripturl$settings$txt;
$bullet '<img src="'.$settings['images_url'].'/TPdivider.gif" alt="" border="0" style="margin:0 2px 0 0;" />';

$result=ssi_recentTopics_Include(3,array(8),'return');

foreach(
$result as $my){
  echo 
"$bullet";
  echo 
'<span class="smalltext">'.$my['link'];

  
// is this topic new? (assume they are logged in)
if (!$my['new'] && $context['user']['is_logged'])
        echo 
' <a href="'$scripturl'?topic='$my['topic'], '.from'$my['new_from'], '#new"><img src="'$settings['images_url'], '/'$context['user']['language'], '/new.gif" alt="'$txt[302], '" border="0" /></a>';
echo 
'<br />';
echo 
' started by '$my['poster']['link'];
echo 
'<br />';
echo 
' last post '$my['time'];
echo 
'<br />';

}
echo 
'</span>';?>
</p>
</div>
            </td>
            <td width="208" valign="top">
            <div align="center">
            <p><a href="http://forum.vailchristian.com/index.php?board=9.0"><img width="190" vspace="5" height="274" border="0" alt="" src="http://www.vailchristian.com/layne/lifeandcommunity2.jpg" /><br />
            Life happens.<br />
            Talk about it here.</a></p>
            <p align="left" class="indented"><?php global $context$scripturl$settings$txt;
$bullet '<img src="'.$settings['images_url'].'/TPdivider.gif" alt="" border="0" style="margin:0 2px 0 0;" />';

$result=ssi_recentTopics_Include(3,array(9),'return');

foreach(
$result as $my){
  echo 
"$bullet";
  echo 
'<span class="smalltext">'.$my['link'];

  
// is this topic new? (assume they are logged in)
if (!$my['new'] && $context['user']['is_logged'])
        echo 
' <a href="'$scripturl'?topic='$my['topic'], '.from'$my['new_from'], '#new"><img src="'$settings['images_url'], '/'$context['user']['language'], '/new.gif" alt="'$txt[302], '" border="0" /></a>';
echo 
'<br />';
echo 
' started by '$my['poster']['link'];
echo 
'<br />';
echo 
' last post '$my['time'];
echo 
'<br />';

}
echo 
'</span>';?>
</p>
</div>
            </td>
            <td width="208" valign="top">
            <div align="center">
            <p><a href="http://forum.vailchristian.com/index.php?board=10.0"><img width="190" vspace="5" height="274" border="0" alt="" src="http://www.vailchristian.com/layne/artsandmedia.jpg" /><br />
            Music, movies, television,<br />
            theater, mime, etc...</a></p>
            <p align="left" class="indented"><?php global $context$scripturl$settings$txt;
$bullet '<img src="'.$settings['images_url'].'/TPdivider.gif" alt="" border="0" style="margin:0 2px 0 0;" />';

$result=ssi_recentTopics_Include(3,array(10),'return');

foreach(
$result as $my){
  echo 
"$bullet";
  echo 
'<span class="smalltext">'.$my['link'];

  
// is this topic new? (assume they are logged in)
if (!$my['new'] && $context['user']['is_logged'])
        echo 
' <a href="'$scripturl'?topic='$my['topic'], '.from'$my['new_from'], '#new"><img src="'$settings['images_url'], '/'$context['user']['language'], '/new.gif" alt="'$txt[302], '" border="0" /></a>';
echo 
'<br />';
echo 
' started by '$my['poster']['link'];
echo 
'<br />';
echo 
' last post '$my['time'];
echo 
'<br />';

}
echo 
'</span>';?>
</p>
</div>
            </td>
        </tr>
        <tr>
            <td width="208" valign="top">
            <div align="center">
            <p><a href="http://forum.vailchristian.com/index.php?board=11.0"><img width="190" vspace="5" height="274" border="0" alt="" src="http://www.vailchristian.com/layne/thelibrary.jpg" /><br />
            Books. What you're reading,<br />
            what you've read, discussions about, reviews of...</a></p>
            <p align="left" class="indented"><?php global $context$scripturl$settings$txt;
$bullet '<img src="'.$settings['images_url'].'/TPdivider.gif" alt="" border="0" style="margin:0 2px 0 0;" />';

$result=ssi_recentTopics_Include(3,array(11),'return');

foreach(
$result as $my){
  echo 
"$bullet";
  echo 
'<span class="smalltext">'.$my['link'];

  
// is this topic new? (assume they are logged in)
if (!$my['new'] && $context['user']['is_logged'])
        echo 
' <a href="'$scripturl'?topic='$my['topic'], '.from'$my['new_from'], '#new"><img src="'$settings['images_url'], '/'$context['user']['language'], '/new.gif" alt="'$txt[302], '" border="0" /></a>';
echo 
'<br />';
echo 
' started by '$my['poster']['link'];
echo 
'<br />';
echo 
' last post '$my['time'];
echo 
'<br />';

}
echo 
'</span>';?>
</p>
</div>
            </td>
            <td width="208" valign="top">
            <div align="center">
            <p><a href="http://forum.vailchristian.com/index.php?board=12.0"><img width="190" vspace="5" height="274" border="0" alt="" src="http://www.vailchristian.com/layne/constantprayer.jpg" /><br />
            A place for prayer: requests, <br />
            praises, or online prayers<br />
            offered corporately.</a></p>
            <p align="left" class="indented"><?php global $context$scripturl$settings$txt;
$bullet '<img src="'.$settings['images_url'].'/TPdivider.gif" alt="" border="0" style="margin:0 2px 0 0;" />';

$result=ssi_recentTopics_Include(3,array(12),'return');

foreach(
$result as $my){
  echo 
"$bullet";
  echo 
'<span class="smalltext">'.$my['link'];

  
// is this topic new? (assume they are logged in)
if (!$my['new'] && $context['user']['is_logged'])
        echo 
' <a href="'$scripturl'?topic='$my['topic'], '.from'$my['new_from'], '#new"><img src="'$settings['images_url'], '/'$context['user']['language'], '/new.gif" alt="'$txt[302], '" border="0" /></a>';
echo 
'<br />';
echo 
' started by '$my['poster']['link'];
echo 
'<br />';
echo 
' last post '$my['time'];
echo 
'<br />';

}
echo 
'</span>';?>
</p>
</div>
            </td>
            <td width="208" valign="top">
            <div align="center">
            <p><a href="http://forum.vailchristian.com/index.php?board=1.0"><img width="190" vspace="5" height="274" border="0" alt="" src="http://www.vailchristian.com/layne/thecafe.jpg" /><br />
            Grab a latte and hang out.<br />
Feel free to talk about anything<br />
            and everything here.</a></p>
            <p align="left" class="indented"><?php global $context$scripturl$settings$txt;
$bullet '<img src="'.$settings['images_url'].'/TPdivider.gif" alt="" border="0" style="margin:0 2px 0 0;" />';

$result=ssi_recentTopics_Include(3,array(1),'return');

foreach(
$result as $my){
  echo 
"$bullet";
  echo 
'<span class="smalltext">'.$my['link'];

  
// is this topic new? (assume they are logged in)
if (!$my['new'] && $context['user']['is_logged'])
        echo 
' <a href="'$scripturl'?topic='$my['topic'], '.from'$my['new_from'], '#new"><img src="'$settings['images_url'], '/'$context['user']['language'], '/new.gif" alt="'$txt[302], '" border="0" /></a>';
echo 
'<br />';
echo 
' started by '$my['poster']['link'];
echo 
'<br />';
echo 
' last post '$my['time'];
echo 
'<br />';

}
echo 
'</span>';?>
</p>
</div>
            </td>
        </tr>
    </tbody>
</table>


This website is proudly hosted on Crocweb Cloud Website Hosting.