vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   Need some help on this, please! (https://vborg.vbsupport.ru/showthread.php?t=42058)

Dark_Wizard 08-08-2002 07:53 AM

Need some help on this, please!
 
I am writing a Gallery script using vbulletins templates and want to list the pics in rows of 3 across. Here is a snippet of my code but everything I tried didn't work.

PHP Code:

<?php
    
require("./global.php");

        
$result $DB_site->query("SELECT * FROM photos WHERE albumid=$album");

        while(
$row $DB_site->fetch_array($result))
        {
        
$picid $row["picid"];
        
$url $row["url"];
        
$title $row["title"];

$counter 0;
$x 0;
  
$x++;
    eval(
"\$gallerybits .= \"".gettemplate("gallery_bits")."\";");

  if(
$x == 3)
  {
    echo 
"</tr><tr>";
    
$x 0;
  }
  
$counter++;
}

eval(
"dooutput(\"".gettemplate("gallery")."\");");
?>

as you can see it isn't complete. Any help would be appreciated.

Here is the gallery_bits template:
Code:

<td>
<normalfont><a href=photo.php?id=$picid><img width="150" border="0" height="150" src="photos/$url" alt="$title"></a>
<br><center>$title</center></normalfont>
</td>


Dark_Wizard 08-09-2002 11:20 AM

^Bump^

I've updated it above with what I have right now.

Lesane 08-13-2002 12:10 PM

Try this:

PHP Code:

<?php
    
require("./global.php");

        
$result $DB_site->query("SELECT * FROM photos WHERE albumid=$album");
        
$counter 0;
        while(
$row $DB_site->fetch_array($result))
        {
        
$picid $row["picid"];
        
$url $row["url"];
        
$title $row["title"];
        
        if (
$counter%3=="2") {  
            echo 
"</tr><tr>";
       } 
    eval(
"\$gallerybits .= \"".gettemplate("gallery_bits")."\";");
  
$counter++;
}

eval(
"dooutput(\"".gettemplate("gallery")."\");");
?>


Dark_Wizard 08-13-2002 06:29 PM

Thx...I'll give it a shot. Thx for the response! :)

Dark_Wizard 08-13-2002 09:04 PM

It works on the first row but every subsequent row there is only 1 pic.... click here

Lesane 08-14-2002 07:49 AM

Play with this line:

PHP Code:

if ($counter%3=="2") { 

set 2 to 0.

Dark_Wizard 08-14-2002 10:26 AM

I got it to work but my problem is with the templates and displaying the pics properly...I can't wait till vb3 where we can use conditionals in the templates....

Dark_Wizard 08-14-2002 10:57 AM

Here is the code I am now using and it works except I can't get it to work with the templates....

PHP Code:

<?php
    
require("./global.php");

        
$result1 $DB_site->query("SELECT * FROM albums WHERE id=$album");

        
$res $DB_site->fetch_array($result1);

        
$event $res["title"];

        
$result $DB_site->query("SELECT * FROM photos WHERE albumid=$album");

$i 0;
    echo 
"<table>\n<tr>\n";

while (
$row mysql_fetch_assoc($result))
{
        
$picid $row["picid"];
        
$url $row["url"];
        
$title $row["title"];

    if ((
$i++ % 3) == 0) { 
        echo 
"</tr>\n<tr>\n";
}
    echo  
"<td><normalfont><a href=photo.php?id=" $row['picid'] . "><img width=\"150\" border=\"0\" height=\"150\" src=\"photos/" $row['url'] . "\" alt=" $row['title'] . "></a><br><center>" $row['title'] . "</center></normalfont></td>\n";
}
        echo 
"</tr>\n</table>\n";
eval(
"dooutput(\"".gettemplate("gallery")."\");");
?>

Any ideas? Here is the gallery template:

Code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>$bbtitle Photo Album</title>
$headinclude
</head>
<body>
$header
<table cellpadding="0" cellspacing="0" border="0"  width="95%" align="center"><tr><td>
<table cellpadding="2" width="100%">
        <tr bgcolor="#336D95" background="https://vborg.vbsupport.ru/images/catagory_backing.gif">
                <td width="100%" align="center" height="28">
<H3>$bbtitle Photo Album</H3>
                </td>
        </tr>
        <tr>
                <td>
<table border="0" cellspacing="1" cellpadding="3"width="100%" align="center">
$gallerybits
</table>
                </td>
        </tr>
</table>
                </td>
        </tr>
</table>
$footer
</body>
</html>

And the gallery_bits template:
Code:

<td><normalfont><a href=photo.php?id=$picid><img width="150" border="0" height="150" src="photos/$url" alt="$title"></a><br><center>$title</center></normalfont></td>

Lesane 08-14-2002 11:17 AM

You are saying in the code (without the template) this:

PHP Code:

echo "<table>\n<tr>\n"

The code with the template you say:

PHP Code:

<table border="0" cellspacing="1" cellpadding="3"width="100%" align="center">
$gallerybits
</table

No <tr> in the code with the template ;)

Dark_Wizard 08-14-2002 11:41 AM

The <tr> is there in the line:
PHP Code:

echo "<table>\n<tr>\n"



All times are GMT. The time now is 07:53 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01724 seconds
  • Memory Usage 1,769KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (7)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete