Webmaster Forum


Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Coding Forum Problems with your code? Let's hear about it.

Directory Submission Service   ClickBooth Network   V7N Directory

Reply
 
LinkBack Thread Tools Display Modes
Old 04-13-2007, 12:57 PM   #1 (permalink)
Junior Member
 
Join Date: 03-21-07
Posts: 20
iTrader: 0 / 0%
Latest Blog:
None

basketmen is liked by many
Question PHP: Change table vertical to horizontal

i have script that shown image in table, i want the table shown in horizontal not vertical
this is the entire script, and the table that influence is in the red i think below

any idea guys what i need to edit?











Quote:
# Photo Album
# 1.1
#
# Displays a members photos
class user_photoplog_album extends z_module
{
# Set the maximum amount of images any users are allowed to display
var $max_images = 5;
function contents()
{
$content = $this->content;
$vbulletin = $this->_zoints->external->vbulletin;

# If limit hasnt been set or is over the admin set maximum, set it to the admin max
if(empty($content['max_pics']) OR $content['max_pics'] > $this->max_images)
{
$limit_sql = 'LIMIT ' . $this->max_images;
}
# Otherwise, let them set it
else
{
$limit_sql = 'LIMIT ' . $content['max_pics'];
}

# Get all photos the user has
$getphotos = $vbulletin->db->query_read("
SELECT * FROM " . TABLE_PREFIX . "photoplog_fileuploads
WHERE userid=" . $this->zuser . "
AND moderate=0
ORDER BY dateline DESC
" . $limit_sql . "
");
$html .= '<div class="' . $this->style['pmain1'] . '" style="padding: 0;">';

# Does the user have any photos?
if ($vbulletin->db->num_rows($getphotos))
{
# Display the top of the table
$html .= '
<table border="0" width="100%">
<tr>
<td width="100" overflow-x: scroll; overflow-y: hidden; align="center" class="phead">
Image
</td>';
# Display the details?
if(!$content['details'])
{
$html .= ' ';
}
$html .= ' </tr>';

# loop and display all that have been fetched from the DB
while($photo = $vbulletin->db->fetch_array($getphotos))
{
# Display image cell
$html .= '
<tr>
<td width="100" align="center" class="pmain2">
<a href="' . $this->_zoints->external->url() . 'imagehosting/image' . $photo['fileid'] . '.html" target="_blank"">
<img src="' . $this->_zoints->external->url() . 'imagehosting/images/' . $photo['userid'] . '/small/' . $photo['filename'] . '" />
</a>
</td>
';
# Display the image details?
if(!$content['details'])
{
$html .= ' ';
}
$html .= '</tr>';
}
$html .= '</table>
<p><a href="index.php?u=' . $this->zuser . '" target="_blank">View All Photos</a>
</p>

<div>
<p>';
}
# Nope, tell them they have none
else
{
$html .= 'You don\'t have any photos. <a href="upload.php" target="_blank">Upload photos now!</a>';
}
$vbulletin->db->free_result($getphotos);

$html .= '</p>
</div>';
return $html;
}

function update($content)
{
return $content;
}
function edit()
{
$content = $this->content;
if($content['max_pics'] AND $content['max_pics'] < $this->max_images)
{
$limit = htmlspecialchars($content['max_pics']);
}
else
{
$limit = $this->max_images;
}
$html .= '<div class="pmain1">';

# Disable description checkbox
$html .= 'Disable image details? ';
$html .= '<input type="checkbox" name="mod[content][details]" ' . ($content['details'] ? 'checked="checked"': '') . ' /> <br />';
# Max pictures textbox
$html .= 'Max pictures to display ';
$html .= '<input type="text" name="mod[content][max_pics]" value="' . $limit . '" size="5" /> ';
$html .= '<span style="font-size: 7pt; color: #848484;">(max ' . $this->max_images . ' allowed)</span> ';

$html .= '</div>';

return $html;
}
}
basketmen is offline  
Add Post to del.icio.us
Reply With Quote
Sponsored Links
SEO Hosting by HostGator  Advertise Here  Buy Blog Links
Old 04-13-2007, 06:59 PM   #2 (permalink)
Inactive
 
StupidScript's Avatar
 
Join Date: 09-22-06
Location: Los Angeles
Posts: 678
iTrader: 0 / 0%
Latest Blog:
None

StupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really nice
Welcome to the forums!

First, add "$oddRow=1;" in this position:
Code:
$oddRow=1; # loop and display all that have been fetched from the DB while($photo = $vbulletin->db->fetch_array($getphotos))
Then, here:
Code:
# Display image cell $html .= ' <tr> <td width="100" align="center" class="pmain2"> <a href="' . $this->_zoints->external->url() . 'imagehosting/image' . $photo['fileid'] . '.html" target="_blank""> <img src="' . $this->_zoints->external->url() . 'imagehosting/images/' . $photo['userid'] . '/small/' . $photo['filename'] . '" /> </a> </td> ';# Display the image details? if(!$content['details']) { $html .= ' '; } $html .= '</tr>'; } $html .= '</table>
Change to:
Code:
# Display image cell if ($oddRow) { $html .= '<tr>'; $oddRow=0; } else { $oddRow=1; } $html .= ' <td width="100" align="center" class="pmain2"> <a href="' . $this->_zoints->external->url() . 'imagehosting/image' . $photo['fileid'] . '.html" target="_blank""> <img src="' . $this->_zoints->external->url() . 'imagehosting/images/' . $photo['userid'] . '/small/' . $photo['filename'] . '" /> </a> </td> '; #TAKE THIS SECTION OUT. IT DOESN'T DO ANYTHING FOR US: # Display the image details? #if(!$content['details']) #{ #$html .= ' '; #} #$html .= '</tr>'; } $html .= '</table>
That will give you two photos, side by side. You'll need to work $oddRow a little differently for more than 2 pictures on a row.
StupidScript is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Centering Horizontal CSS Menu thecoolkid Coding Forum 13 08-30-2007 09:59 PM
Showing data from a table based on infos from another table! anarchoi Coding Forum 0 06-16-2007 04:58 PM
Add vertical scroll bar to a table Alexandro Coding Forum 2 05-23-2007 11:41 PM
difference in IE and FF with horizontal navigation sachi Web Design Lobby 0 10-11-2006 10:08 PM
Vertical vs. Horizontal Marketing mighty Marketing Forum 2 02-26-2004 08:41 AM


Sponsor Links
Get exposure! Get exposure! Find Scripts Web Hosting Directory Get exposure! SEO Blog


All times are GMT -7. The time now is 05:47 AM.
© Copyright 2008 V7 Inc