View Single Post
  #1  
Old 07-19-2005, 01:24 PM
Acedeal Acedeal is offline
 
Join Date: Jul 2005
Location: Texas
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default define statements in php

Hey all,

Does vb reconise this type of statement in php files
if not what would be the correct way to address this?

somefile.php
PHP Code:
define('ARTISTS_TABLE'$vbmod_prefix.'artists');
define('SONGS_TABLE'$vbmod_prefix.'songs');
etc
etc 
so if i had this db query
PHP Code:
// select the featured songs
//

$sql 'SELECT ' SONGS_TABLE '.song_id, song_title, ' ARTISTS_TABLE '.artist_id, artist_name, artist_prefix
 FROM     ' 
SONGS_TABLE ', ' ARTISTS_TABLE .
WHERE (' 
SONGS_TABLE '.artist_id = ' ARTISTS_TABLE '.artist_id ) AND
        ( status_id = "' 
$mod_config['feature_status'] . '" )';
$sql append_status_sql($sql);
$sql .= 'ORDER BY song_id DESC';
$result $db->sql_query($sql);
while (
$row $db->sql_fetchrow($result))
{
    
$sql 'SELECT song_desc 
        FROM ' 
SONG_DESC_TABLE 
        WHERE (song_id = "' 
$row['song_id'] . '") 
        LIMIT 1'
;
    
$desc_result $db->sql_query($sql);
    
$song_desc $db->sql_fetchfield('song_desc''0'$desc_result);
    
$template->assign_block_vars('featured_songs', Array(
        
'SONG_DESC' => prepare_text($song_desc),
        
'SONG_TITLE' => $row['song_title'],
        
'ARTIST_NAME' => artist_add_prefix($row['artist_name'], $row['artist_prefix']),
        
'U_VIEWSONG' => append_sid('view_song.php?id=' $row['song_id']),
        
'U_VIEWARTIST' => append_sid('view_artist.php?id=' $row['artist_id']),
        )
    );
}
snip]] 
Reason for asking, switched over from phpbb and not sure I have a grasp of vb's sql and template engines-
as mention just switched over from phpbb and need to convert some apps and their template engine is a lot differnt

In the php file I had something like this
PHP Code:
$template->assign_block_vars('list',Array(
           
'SONG_LENGTH' => format_length($sql_data['song_length']),
       
'SONG_QUALITY' => $sql_data['song_quality'],
       
'SONG_SIZE' => $sql_data['song_size'],
           
'SONG_BOX' => $song_box,
       
'ADDED_BY' => cut_string($sql_data['username'], 21)
        )
    ); 
so I could just place {SONG_SIZE} {SONG_BOX}in template and it will pull the correct data from the php / sql pages and place in either a cell/or table in the template. {SONG_SIZE} would put the size of song and {SONG_BOX) would build some cells / tables from another template

How would I convert these template to use VB's template engine/variables

Thanks in advance!
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01242 seconds
  • Memory Usage 1,801KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete