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,019
  • Total Topics: 21,332
  • Online today: 1,062
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 357
  • Total: 357

adding a bullet to php block

Started by cepsi, April 04, 2009, 01:09:07 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

cepsi

hi,

im trying to add a bullet to a peice of php code (a recent topics block). i have a play around with it and a search around for it but no joy :( i basically want a bullet before each topic. this is the bullet i want to use;

$bullet = '<img src="'.$settings['images_url'].'/TPdivider.gif" alt="" border="0" style="margin:0 2px 0 0;" />';

and this is the peice of code im trying to get it into...

global $scripturl; echo '

<table border="0, position: static;"" width="99%, position: static;" cellspacing="1,position: static;" cellpadding="2,position: static;" class="bordercolor"> ';

// To show more posts change the number at recentTopics('8', to the amount you want.

// To hide specific rooms from the PHPscript replace the """, NULL,""" with """, array('7','56'),""" as an example.
// The numbers at the array = the rooms ID number. To find out what ID number the room you want to hide is, just klick on it.
// Then see what number it is at the end of the url. For example: /index.php?board=7.0 is the same as number 7

//This is the codeline you alter to change the amount of topics to show + hide rooms.
$what=ssi_recentTopics('4', array('2','3','4','6','8','18','19','20','42','104','135','109','106','105','144',), 'array');

foreach ($what as $topic){echo '

<tr>
<td class="windowbg" valign="middle">

<span class="smalltext">', $topic['link'];

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

echo '
<br>
<span class="smalltext"> ', $topic['time'],'
<br>
by: ', $topic['poster']['link'], '
</span>
</span>
</td>
</tr>
';}echo '
</table>
';


i thought it would go somewhere around this foreach ($what as $topic){echo ' with $bullet2 but after hours of fiddling ive had no success  and need help please!!!  :o

tyvm for any help

JPDeni

I'm not sure where you want the image to display. In front of the titles? I'll assume that's what you want.

Part of your problem may be the way you've formatted the code. It really is hard to follow. I reformatted it and added the code.


global $scripturl, $settings;

$bullet = '<img src="'.$settings['images_url'].'/TPdivider.gif" alt="" border="0" style="margin:0 2px 0 0;" />';

echo '<table border="0, position: static;"" width="99%, position: static;" cellspacing="1,position: static;" cellpadding="2,position: static;" class="bordercolor"> ';

// To show more posts change the number at recentTopics('8', to the amount you want.

// To hide specific rooms from the PHPscript replace the """, NULL,""" with """, array('7','56'),""" as an example.
// The numbers at the array = the rooms ID number. To find out what ID number the room you want to hide is, just klick on it.
// Then see what number it is at the end of the url. For example: /index.php?board=7.0 is the same as number 7

//This is the codeline you alter to change the amount of topics to show + hide rooms.
$what=ssi_recentTopics('4', array('2','3','4','6','8','18','19','20','42','104','135','109','106','105','144',), 'array');

foreach ($what as $topic){
echo '
<tr>
<td class="windowbg" valign="middle">' . $bullet . '<span class="smalltext">', $topic['link'];

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

echo '
<br><span class="smalltext"> ', $topic['time'],' <br>by: ', $topic['poster']['link'], '</span>
</span></td></tr>';
}
echo '</table>';


Basically, you needed to do three things: add $settings to your "global" statement, add the variable definition and then put the variable where it needs to be.

cepsi

#2
thx JP, i have another bit of code im trying to do something similiar with so will have a go using the changes you made here for me.

and yes srry bullet in right place srry didnt explain better

This website is proudly hosted on Crocweb Cloud Website Hosting.