vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   How would I loop this for my new hack? (https://vborg.vbsupport.ru/showthread.php?t=41713)

DrkFusion 07-30-2002 11:20 PM

How would I loop this for my new hack?
 
Hi,
in one of my codes I have
Code:

$listings = "<a href=reviews.php?s=$session[sessionhash]&action=view&revid=$ra[id]>$ra[review_name]</a>-$ra[review_by]<br>";
eval("dooutput(\"".gettemplate("reviews_list")."\");");

How would I repeat $listings, as many times as I need?
I saw a code that firefly posted, see below:
Code:

function loop_template($vars, $template, $subtemplate, $table, $conditions = '') {
    global $DB_site;
    $dblink = $DB_site->query("SELECT $vars FROM $table $conditions");
    while ($db_array = $DB_site->fetch_array($dblink)) {
        foreach ($db_array as $field => $value) {    // DO NOT use while here
            $array["{$subtemplate}_{$field}"] = $value;
            unset($array["$field"]);
        }
        eval('$return .= "'.gettemplate($template.'_'.$subtemplate).'";');
    }
    $DB_site->free_result($dblink);
    return $return;
}

How would I apply my stuff to that?
Thanks in Advance
Drk

Logician 07-31-2002 12:05 PM

what do you mean by repeat? Are you trying to echo it X times in your template or screen or smt?

What about this:

$listing1 = str_repeat($listing , 10);

Needless to say I'm sure you know how to use "for" loops, I guess?


All times are GMT. The time now is 05:01 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.01057 seconds
  • Memory Usage 1,708KB
  • 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
  • (2)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)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