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: 103
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 242
  • Total: 242

Block align = right

Started by domeen, July 19, 2007, 09:11:41 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

domeen

hello I ahve put the following code into a block on the right, but now I want to align the text (see below) also on the right... How can I do That..?



global $db_prefix, $context, $user_info, $scripturl;

$bullet = '<img src="'.$settings['images_url'].'/TPdivider.gif" alt="" border="0" style="margin:0 2px 0 0;" />';
if (!isset($context['jump_to']))
{
// Find the boards/cateogories they can see.
$request = db_query("
SELECT c.name AS catName, c.ID_CAT, b.ID_BOARD, b.name AS boardName, b.childLevel
FROM {$db_prefix}boards AS b
LEFT JOIN {$db_prefix}categories AS c ON (c.ID_CAT = b.ID_CAT)
WHERE $user_info[query_see_board]", __FILE__, __LINE__);
$context['jump_to'] = array();
$this_cat = array('id' => -1);
while ($row = mysql_fetch_assoc($request))
{
if ($this_cat['id'] != $row['ID_CAT'])
{
$this_cat = &$context['jump_to'][];
$this_cat['id'] = $row['ID_CAT'];
$this_cat['name'] = $row['catName'];
$this_cat['boards'] = array();
}

$this_cat['boards'][] = array(
'id' => $row['ID_BOARD'],
'name' => $row['boardName'],
'child_level' => $row['childLevel'],
'is_current' => isset($context['current_board']) && $row['ID_BOARD'] == $context['current_board']
);
}
mysql_free_result($request);
}

foreach ($context['jump_to'] as $category)
{
echo '<span class="smalltext" style="text-decoration: underline; font-weight: bold;">', $category['name'], '<br /></span>';
foreach ($category['boards'] as $board)
echo '<span class="smalltext"><a href="' . $scripturl . '?board=' . $board['id'] . '.0">'. str_repeat($bullet, $board['child_level'] + 1) . $board['name'] . '</a><br /></span>';
}

Ianedres

My guess (without testing) is to find the two instances of:

echo '<span class="smalltext"

near the bottom of the code and then add align="right" after "smalltext".

You may have to do the same with the image reference in the $bullet line - try putting the same align="right" behind the alt="" portion.

Good luck.

Ianedres

Scratch that. Had to try it and found that it didn't work.

Put a <DIV align="right"> statement at the front of the <SPAN> tags and close with </DIV> at the </SPAN> tag.

Try this:
global $db_prefix, $context, $user_info, $scripturl;

$bullet = '<img src="'.$settings['images_url'].'/TPdivider.gif" alt="" align="right" border="0" style="margin:0 2px 0 0;" />';
if (!isset($context['jump_to']))
{
// Find the boards/cateogories they can see.
$request = db_query("
SELECT c.name AS catName, c.ID_CAT, b.ID_BOARD, b.name AS boardName, b.childLevel
FROM {$db_prefix}boards AS b
LEFT JOIN {$db_prefix}categories AS c ON (c.ID_CAT = b.ID_CAT)
WHERE $user_info[query_see_board]", __FILE__, __LINE__);
$context['jump_to'] = array();
$this_cat = array('id' => -1);
while ($row = mysql_fetch_assoc($request))
{
if ($this_cat['id'] != $row['ID_CAT'])
{
$this_cat = &$context['jump_to'][];
$this_cat['id'] = $row['ID_CAT'];
$this_cat['name'] = $row['catName'];
$this_cat['boards'] = array();
}

$this_cat['boards'][] = array(
'id' => $row['ID_BOARD'],
'name' => $row['boardName'],
'child_level' => $row['childLevel'],
'is_current' => isset($context['current_board']) && $row['ID_BOARD'] == $context['current_board']
);
}
mysql_free_result($request);
}

foreach ($context['jump_to'] as $category)
{
echo '<div align="right"><span class="smalltext" style="text-decoration: underline; font-weight: bold;">', $category['name'], '<br /></span></div>';
foreach ($category['boards'] as $board)
echo '<div align="right"><span class="smalltext" align="right" ><a href="' . $scripturl . '?board=' . $board['id'] . '.0">'. str_repeat($bullet, $board['child_level'] + 1) . $board['name'] . '</a><br /></span></div>';
}

domeen

yes it works  :up:

and how about this code?


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


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

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

echo '<BR>
';
}
echo '</span>';

Ianedres

Should be able to put <DIV align="right"> before the <SPAN> tags, and close with </DIV> after the closing </SPAN> tag.

This is what was done in your first question...

Looking at the line echo "$bullet";, the quotation marks don't appear necessary. Could use this to put the bullet on the right:

echo '<DIV align="right">'.$bullet.'</DIV>';

domeen

Hey, If I do that, the alignment for the bullet isn't good..

I get:

bullet
text
bullet
text

Ianedres

You will either need to find the code that the string $bullet refers to and check it for <BR> tags, or just echo your own bullet with the <IMG> tag in that line instead.

domeen


IchBin

Just to make a note here, ALWAYS use lower case tags in HTML. :)

XHTML compliant. :up:

Ianedres

Quote from: IchBinâ„¢ on July 19, 2007, 10:09:10 PM
Just to make a note here, ALWAYS use lower case tags in HTML. :)

XHTML compliant. :up:

Couldn't remember (it crossed my mind) - and too lazy to look it up...  :o

This website is proudly hosted on Crocweb Cloud Website Hosting.