php code help to "center" text for a block

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   php code help to "center" text for a block
gadford
CZ Active Member
 Codezwiz Site Donator
gadford has been a member for over 20 year's 20 Year Member
usa.gif arkansas.gif
Occupation: Wachter Network Services
Age: 48
Gender: Male
Fav. Sports Team: Da Bearz
Website:
Status: Offline
Joined: Jun 15, 2004
0.01 posts per day
Posts: 109
Points: 27
  MSN Messenger 
I have a "Today in History" block in use that I would like to use as a center block, but the text is currently formatted to the left. It pulls sql data from the ephemerids section of my db, so I'm not quite sure which part of the code to manipulate/change.

if (eregi("block-Today_in_History.php",$PHP_SELF)) {
    Header("Location: index.php");
    die();
}

// Number of items to retrieve
$getnum = "10";
// Scroll Direction (up,down)
$scroll_direction = "up";
// Scroll Height
$scroll_height = 200;
// Scroll Delay
$scroll_delay = 100;
// Scroll Amount
$scroll_amount = 2;

global $prefix, $db, $querylang;

$today = getdate();
$eday = $today[mday];
$emonth = $today[mon];
$eyear = $today[year];
$lmonth = $today[month];
$title = ""._EPHEMERIDS."";
$output_buffer .= "<b>Today is $lmonth $eday, $eyear</b><br><HR noshade SIZE=3 width=\"90%\">";
$sql = "SELECT yid, content FROM ".$prefix."_ephem WHERE did='$eday' AND mid='$emonth' $querylang ORDER BY RAND() LIMIT $getnum";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
      $content_list[$row[yid]] = "$row[content]";
}
ksort($content_list);
while (list($yr, $con) = each($content_list)) {
    if ($cnt == 1) {
   $boxstuff .= "<br><br>";
    }
    $output_buffer .= "<b>$yr:</b> <BR>$con";
    $output_buffer .= "<br><HR noshade SIZE=3 width=\"90%\">";
    $cnt = 1;
}
$content = "";
$content .= "<TABLE width=\"100%\">";
$content .= "<TR><TD>";
$content .= "<MARQUEE behavior=\"scroll\" height=\"$scroll_height\" direction=\"$scroll_direction\" scrollamount= \"$scroll_amount\" scrolldelay=\"$scroll_delay\" onmouseover='this.stop()' onmouseout='this.start()'>".$output_buffer."</MARQUEE>";
$content .= "</TD></TR>";
$content .= "</TABLE>";
?>


I would like to get the scrolling text to be centered instead of justified to the left...which I assume is the default. I'm sure there is an easy fix for this but all ive done so far is hose the block. tia for any suggestions


Back to top Reply with quote
#2   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,430
   
Try changing this line

$content .= "<TR><TD>";


To this line

$content .= "<TR><TD align='center'>";




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#3   re: php code help to "center" text for a block
gadford
CZ Active Member
 Codezwiz Site Donator
gadford has been a member for over 20 year's 20 Year Member
usa.gif arkansas.gif
Occupation: Wachter Network Services
Age: 48
Gender: Male
Fav. Sports Team: Da Bearz
Website:
Status: Offline
Joined: Jun 15, 2004
0.01 posts per day
Posts: 109
Points: 27
  MSN Messenger 
Ok - I tried that with no luck icon_sad.gif

Would adding code to the marquee behavior line work?



Back to top Reply with quote
#4   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,430
   
Thats strange try changing this line also

$content .= "<TABLE width=\"100%\">";


to

$content .= "<TABLE width=\"100%\" align =\"center\">";




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#5   re: php code help to "center" text for a block
gadford
CZ Active Member
 Codezwiz Site Donator
gadford has been a member for over 20 year's 20 Year Member
usa.gif arkansas.gif
Occupation: Wachter Network Services
Age: 48
Gender: Male
Fav. Sports Team: Da Bearz
Website:
Status: Offline
Joined: Jun 15, 2004
0.01 posts per day
Posts: 109
Points: 27
  MSN Messenger 
tried that as well without any luck icon_sad.gif

here is what the block currently looks like:

<?php

/********************************************************************/
/* Today in History Block                                           */ 
/* ===========================                                      */                                     
/* By Greg Schoper                                                  */
/* http://nuke.schoper.net                                          */
/*                                                                  */
/* Based on code from block-ephemerids.php                          */
/* Copyright (c) 2002 by Francisco Burzi                            */
/* http://phpnuke.org                                               */
/*                                                                  */
/* This program is free software. You can redistribute it and/or    */
/* modify it under the terms of the GNU General Public License as   */
/* published by the Free Software Foundation; either version 2 of   */
/* the License.                                                     */
/********************************************************************/

if (eregi("block-Today_in_History.php",$PHP_SELF)) {
    Header("Location: index.php");
    die();
}

// Number of items to retrieve
$getnum = "10";
// Scroll Direction (up,down)
$scroll_direction = "up";
// Scroll Height
$scroll_height = 100;
// Scroll Delay
$scroll_delay = 100;
// Scroll Amount
$scroll_amount = 2;

global $prefix, $db, $querylang;

$today = getdate();
$eday = $today[mday];
$emonth = $today[mon];
$eyear = $today[year];
$lmonth = $today[month];
$title = ""._EPHEMERIDS."";
$output_buffer .= "<b>Today is $lmonth $eday, $eyear</b><br><HR noshade SIZE=3 width=\"90%\">";
$sql = "SELECT yid, content FROM ".$prefix."_ephem WHERE did='$eday' AND mid='$emonth' $querylang ORDER BY RAND() LIMIT $getnum";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
      $content_list[$row[yid]] = "$row[content]";
}
ksort($content_list);
while (list($yr, $con) = each($content_list)) {
    if ($cnt == 1) {
   $boxstuff .= "<br><br>";
    }
    $output_buffer .= "<b>$yr:</b> <BR>$con";
    $output_buffer .= "<br><HR noshade SIZE=3 width=\"90%\">";
    $cnt = 1;
}
$content = "";
$content .= "<TABLE width=\"100%\" align =\"center\">";
$content .= "<TR><TD align='center'>";
$content .= "<MARQUEE behavior=\"scroll\" height=\"$scroll_height\" direction=\"$scroll_direction\" scrollamount= \"$scroll_amount\" scrolldelay=\"$scroll_delay\" onmouseover='this.stop()' onmouseout='this.start()'>".$output_buffer."</MARQUEE>";
$content .= "</TD></TR>";
$content .= "</TABLE>";
?>



Back to top Reply with quote
#6   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,430
   
Change

scrollamount= \"$scroll_amount\" scrolldelay=\"$scroll_delay\" onmouseover='this.stop()' onmouseout='this.start()'>".$output_buffer."</MARQUEE>";


to

scrollamount= \"$scroll_amount\" scrolldelay=\"$scroll_delay\" onmouseover='this.stop()' onmouseout='this.start()'><center>".$output_buffer."</center></MARQUEE>";




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#7   re: php code help to "center" text for a block
gadford
CZ Active Member
 Codezwiz Site Donator
gadford has been a member for over 20 year's 20 Year Member
usa.gif arkansas.gif
Occupation: Wachter Network Services
Age: 48
Gender: Male
Fav. Sports Team: Da Bearz
Website:
Status: Offline
Joined: Jun 15, 2004
0.01 posts per day
Posts: 109
Points: 27
  MSN Messenger 
right on! that last one did it. thanks telli



Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum