Quote:
Originally Posted by MarcoH64
./includes/db_mysql.php
But no need to change anything to those.
|
Thanks..
Was not going to re-write anything in there-
Just need to figure out how to redo all my scripts that I have to match all this VB stuff.
Probally easier for me to just hire someone to do it, I don;t have the time, nor the inclination at the moment to redo all my php mods that I want to port over.
https://vborg.vbsupport.ru/showthread.php?t=92550
looks like everything in regards to this type of coding is going to have to be redone
PHP Code:
$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))
due to it's kicking out variables that your template engine can not use / parse--
what would be this best way to redo this so that I can get them in the templates
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)
)
);
just change it to
PHP Code:
vars('list',( Array(
$SONG_LENGTH => 'format_length($sql_data['song_length']),
$ADDED_BY => 'cut_string($sql_data['username'], 21)
the function to get the lenght
PHP Code:
function format_length($length)
{
$length_hour = floor($length / 3600);
$length_min = floor(($length - ($length_hour * 3600)) / 60);
$length_sec = $length - (($length_min * 60) + ($length_hour * 3600)) ;
if ($length_hour > 0)
{
$f_length = $length_hour . ':';
}
if ($length_min < 10 && $length_hour > 0)
{
$f_length .= '0';
}
$f_length .= $length_min . ':';
if ($length_sec < 10)
{
$f_length .= '0';
}
$f_length .= $length_sec;
return($f_length);
}
function cut_string($string, $length)
{
if (strlen($string) > $length)
{
$string = substr($string, 0, $length - 2) . '...';
}
return($string);
}
then in template I would just put in
Code:
<td>$SONG_LENGTH</td>
td>$ADDED_BY</td>
Hope I don't have to re-write all this, prolly why it's easier to just hire someone lolol