vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   /me needs help ;) (https://vborg.vbsupport.ru/showthread.php?t=50923)

Dean C 03-28-2003 07:01 PM

/me needs help ;)
 
PHP Code:

$getthebanners $DB_site->query("SELECT * FROM artists");
while(
$boohoo $DB_site->fetch_array($getthebanners)) {
eval(
"dooutput(\"".gettemplate("displayartists")."\");");


When i put $boohoo[name] in the displayartists template it only calls the name of one artist and not all :(

Btw name is a field in the table artists :D

Any ideas?

Regards

- miSt

g-force2k2 03-28-2003 07:59 PM

Mist hope this helps...

PHP Code:

$getthebanners $DB_site->query"SELECT * FROM artists" );
  while( 
$boohoo $DB_site->fetch_array$getthebanners ) )
    eval( 
"\$theartists.= \"".gettemplate'displayartistsbit' )."\" ;" );

  eval( 
"dooutput( \"".gettemplate'displayartists' )."\" );" );
  exit; 

you need the create a template "displayartistsbit" and put in there the info you want to repeat... then the "displayartists" template is the main template... in which you put the "$theartists" to echo the loop that you created...

hope that helps Mist...

regards,
g-force2k2

Dean C 03-29-2003 11:43 AM

Ahhh thanks g-force...

I understand the concept now :D

Good to see you back btw :)

- miSt

Dean C 03-29-2003 05:33 PM

Btw g-force that was the right idea but it didn't work. I had to add braces ;)

PHP Code:

$gettheartists $DB_site->query"SELECT * FROM artists" );
  while( 
$boohoo $DB_site->fetch_array$gettheartists ) ) {
    eval( 
"\$theartists.= \"".gettemplate'displayartistsbit' )."\" ;" );
  }
  eval( 
"dooutput( \"".gettemplate'displayartists' )."\" );" );
  exit; 

Regards

- miSt

filburt1 03-29-2003 05:57 PM

As you always should for multiple-line blocks to prevent problems that look fine but that are only the illusion of indenting.

g-force2k2 03-31-2003 01:37 PM

hmm... you sure Mist?

because to my knowledge you don't need to add brackets for one line codes... unless you altered the code in anyway ( adding more info inside the while for instance )

because the example:
PHP Code:

if( $this == "that: )
  echo 
$this

is the same as:
PHP Code:

if( $this == "that" )
{
  echo 
$this;


just if you don't have brackets it will only read one line to my knowledge if you added more code thats probably why you got an error...

regards,
g-force2k2

filburt1 03-31-2003 03:51 PM

It's extremely bad style to do that first example because it can very easily lead to screwups when editing the code.

Dean C 03-31-2003 03:53 PM

100% sure - PPN helped me out with it and said put brackets and then it worked :D

- miSt


All times are GMT. The time now is 05:15 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.01565 seconds
  • Memory Usage 1,729KB
  • 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
  • (5)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete