PDA

View Full Version : I can not display


Preech
04-17-2012, 05:53 PM
So this is my php script.
<?php

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################

define('THIS_SCRIPT', 'vbmusic_album');
define('CSRF_PROTECTION', true);
// change this depending on your filename

// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();

// get special data templates from the datastore
$specialtemplates = array();

// pre-cache templates used by all actions
$globaltemplates = array('vbmusic_album',
);

// pre-cache templates used by specific actions
$actiontemplates = array('vbmusic_album');

// ######################### REQUIRE BACK-END ############################
// if your page is outside of your normal vb forums directory, you should change directories by uncommenting the next line
// chdir ('/path/to/your/forums');
require_once('./global.php');



// ################################################## #####################
// ######################## START MAIN SCRIPT ############################
// ################################################## #####################

$navbits = construct_navbits(array('' => 'Album'));
$navbar = render_navbar_template($navbits);



// ###### YOUR CUSTOM CODE GOES HERE #####

$vbulletin->input->clean_gpc('r', 'id', TYPE_UINT);
$id = $vbulletin->GPC['id'];


$track = $db->query_read("SELECT tr.trname, tr.playtime AS tracktime, tr.tracknr, tr.trid, al.*,
ar.arname, co.cdecname, cd.cdid, cd.playtime AS cdtime, cd.cdname, ge.genname,
cn.cntyname, fe.ext AS filext
FROM " . TABLE_PREFIX. " track tr
LEFT JOIN cdlist cd ON cd.cdid=tr.cdid
LEFT JOIN album al ON al.alid=cd.alid
LEFT JOIN artist ar ON ar.arid=al.arid
LEFT JOIN codec co ON co.cdecid=al.codec
LEFT JOIN genre ge ON ge.genid=al.genre
LEFT JOIN country cn ON cn.id=al.country
LEFT JOIN filext fe ON fe.id=tr.extid
WHERE cd.alid=$id ORDER BY cd.cdname,tr.tracknr, tr.trname");

$cdcnt=1;
$cdid='0';
$cdname='';

$mart = array();
if ($db->num_rows($track))
{
while ($musical = $db->fetch_array($track))
{
$mart[] = $musical;

}

}
$db->free_result($track);








// ###### NOW YOUR TEMPLATE IS BEING RENDERED ######

$templater = vB_Template::create('vbmusic_album');
$templater->register_page_templates();
$templater->register('navbar', $navbar);
$templater->register('mart', $mart);
print_output($templater->render());

?>
// ###### NOW YOUR TEMPLATE IS BEING RENDERED ######

So it seems to me, everything is correct, no errors. When I go to try to get my data to show up through the template, nothing. Could anyone explain to me what I'm doing wrong.

Before I forget. I am getting to this page by clicking a link from another page.
The link is something like this. something.php?id={vb:raw something}
I got the id..but I can't get any of the info that may go with that id.

Lynne
04-17-2012, 09:51 PM
What does your template look like?

Preech
04-18-2012, 05:42 AM
{vb:stylevar htmldoctype}
<html xmlns="http://www.w3.org/1999/xhtml" dir="{vb:stylevar textdirection}" lang="{vb:stylevar languagecode}" id="vbulletin_html">
<head>
<title>{vb:raw vboptions.bbtitle} - {vb:raw pagetitle}</title>
{vb:raw headinclude}
{vb:raw headinclude_bottom}

<script type="text/javascript">
<!--
function PlayPop(filedesc,id,WindowNumber)
{
Play = window.open('',WindowNumber,'width=620,height=420, top=0,left=0,screenX=0,screenY=0,resizable=0,scrol lbars=0,titlebar=0,toolbar=0,menubar=0,status=0,di rectories=0');
Play.focus();
Play.document.writeln("<html><head>");
Play.document.writeln("<title>" + filedesc + "</title>");
Play.document.writeln("<link rel='stylesheet' type='text/css' href='images/css.css'></head>");
Play.document.writeln("<body style='background-color:#727e8c'><div align='center'><br />");

Play.document.writeln("<table cellspacing='0' cellpadding='0' border='0' width='90%'><tr><td align='left'><img src='images/obenlinks.gif' /></td><td width='100%' class='obenmitte' align='center'></td><td align='right'><img src='images/obenrechts.gif'></td></tr></table>");
Play.document.writeln("<table class='tablec' width='90%' cellspacing='20'><tr><td align='center' class='data1'>");
Play.document.writeln("<b>" + filedesc + "</b></td></tr></table>");
Play.document.writeln("<table class='tabled' width='90%' cellspacing='10'><tr><td align='center'>");
Play.document.writeln("<object type='application/x-shockwave-flash' width='500' height='170' ");
Play.document.writeln("data='js/xspf_player.swf?" + id + \"&autoplay=1'>");
Play.document.writeln("<param name='movie'");
Play.document.writeln("value='js/xspf_player.swf?playlist_url=playlist/" + id + ".xml&autoplay=1'></object>");
Play.document.writeln("</td></tr></table>");
Play.document.writeln("<table class='tablec' width='90%' cellspacing='10'><tr><td align='center'>");
Play.document.writeln("<br /><form><input class='button' type='button' value='Close window' onclick='javascript:window.close();'></form></td></tr></table>");
Play.document.writeln("<table cellspacing='0' cellpadding='0' border='0' width='90%'><tr><td align='left'><img src='images/untenlinks.gif' /></td><td width='100%' class='untenmitte' align='center'></td><td align='right'><img src='images/untenrechts.gif'></td></tr></table>");
Play.document.writeln("<br /></body></html>");
Play.document.close();
}
// -->
</script>
</head>
<body>

{vb:raw header}

{vb:raw navbar}


<div class="colmask leftmenu">
<div class="colleft">
<div class="col1">
<!-- Column 1 start -->

<div class="audio_head">
<h1>
<table align="center" cellspacing="1" cellpadding="0" width="100%">
<tr>
<td style="width:7%" align="center" class="data2"><b>Track</b></td>
<td style="width:75%" align="center" class="data2"><b>Track name</b></td>
<td style="width:8%" align="center" class="data2"><b>Time</b></td>
<td style="width:10%" align="center" class="data2"><b>Action</b></td>
</tr>
</table>
</h1></div>
<div class="audio_body">


</div>



<!-- Column 1 end -->
</div>
<div class="col2">
<!-- Column 2 start -->

<div class="audio_head">
<h1>
{vb:raw cdname}
</h1></div>
<div class="audio_body">
<span class="column">

<center>
<vb:if condition="$musical['cvrsaved'] == yes">
<img src="./audio/covers/{vb:raw musical.cvrsaved}/jpg" width="230px" border="0" ">
<vb:else />
<img src="./audio/covers/no_cover.jpg" width="230px" border="0" ">
</vb:if>
</center>

</span>
</div>
<br />
<div class="audio_head">
<h1>
Album Info
</h1></div>
<div class="audio_body">
<table align="center" cellspacing="12" cellpadding="0" style="width:100%">
<tr>
<td align="left" class="data1">Artist : <a href="vbmusic_artist.php?id={vb:raw artid}">{vb:raw artname}</a> </td>

</tr>
<tr>
<td align="left" class="data1">Album : {vb:raw alname}</td>
</tr>
<tr>
<td align="left" class="data1">Genre :{vb:raw genname}</td>
</tr>
<tr>
<td align="left" class="data1">Release Year :{vb:raw year}</td>
</tr>
<tr>
<td align="left" class="data1">Size :{vb:raw alsize}</td>
</tr>
<tr>
<td align="left" class="data1">Added :{vb:raw added}</td>
</tr>
</table>
</div>



<!-- Column 2 end -->
</div>
</div>
</div>

{vb:raw footer}
</body>
</html>

Lynne
04-18-2012, 02:22 PM
You have several variables in your template that you did not register for use in there - $alname, $genname, $year, etc. So, nothing is going to show up for any of those variables until you register them for use in there.

Preech
04-18-2012, 03:51 PM
I'll work on it..than check back later if I still haven't got it to work.