The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
![]()
In the following PHP code
I want to test the what the templatecache or the database or both how do it in PHP of the line below. $dummy = fetch_template('groups_index_listbit'); // returns a string echo $dummy; What is actualy being returned here ? string fetch_template (string $templatename); where string $templatename: Name of template to be fetched So How do I debug this and echo the values correctly above here. Note: This works fine here and I can echo the values in the actaul array. echo $groupslist[id]; echo "<br>"; echo $groupslist[groupname]; echo "<br>"; eval('$groupslist .= "' . fetch_template('groups_index_listbit') . '";'); Why does the line above need the . dot operator is it becuse it is a string type being returned ? How does the eval work in the above case in vbullutin please explain. THANKS |
#2
|
|||
|
|||
![]()
The groups_index_listbit template is a template that will be looped several times. When you add the concatenating assignment operator ('.='), this will allow you to call this template over and over again untill the MySQL query runs out of data.
For example: If you wanted to echo every username in your database, you would create a mysql query telling the database to give you all usersname is the user row. And echo everyname. Heres how we would do this. The $query variable holds the mysql commands. Code:
$query = $db->query_read(" SELECT username FROM " . TABLE_PREFIX . "user "); Code:
while ($user = $db->fetch_array($templates)) { //now you are able to echo the username over and over again. You could simply add this... echo $user['username']; //remember $user is the array, and the "username" is the row you want to echo, you can only echo the rows you have selected from your query above. (SELECT username FROM...etc...) // if you want to use a template to echo the information, you wouldn't want to create 500 templates just because you have 500 usernames in the database. Hell no, you would simply add one BIT template and use the following code... eval('$mynewtemp .= "' . fetch_template('username_templatebit') . '";'); // now, in your template where you want the results to show, you would add $mynewtemp anywhere in your main template code. // in the template called username_templatebit you would use the user[username] var to echo echo username } ![]() |
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|