101
tank1955
Developing custom template and hit a brick wall - Please help
  • 2008/2/20 4:07

  • tank1955

  • Module Developer

  • Posts: 276

  • Since: 2007/9/7 1


I am developing a calendar module and have hit a brick wall in trying to get a custom template working to display all the date entries.

XOOPS 2.0.16
PHP/MySQL 4.1.22
Apache Server / Linux

My template definition in the xoops_version.php file appears as follows:

// Templates
$modversion['templates'][1]['file'] = 'playdates_displaylistall.html';
$modversion['templates'][1]['description'] = '';

The template file resides in the module's templates directory. Here is a copy

<table border="0" cellpadding="0" cellspacing="1" width="100%">
<tr class='even'>
<td align='left'><b><{$lang_date}>/<{$lang_time}></b></td>
<td align='left'><b><{$lang_band}></b></td>
<td align='left'><b><{$lang_venue}></b></td>
<td align='left'><b><{$lang_location}></b></td>
<td align='left'><b><{$lang_info}></b></td>
</tr>

<{section name=i loop=$dates_all}>
<tr class="<{cycle values="odd,even"}>">
<td><{$dates_all[i].date}>&nbsp;&nbsp;<{$dates_all[i].time}></td>
<td><{$dates_all[i].band}></td>
<td><{$dates_all[i].venue}></td>
<td><{$dates_all[i].city}>,&nbsp;<{$dates_all[i].state}></td>
<{if $dates_all[i].info}>
<td><a href="index.php?op=show&id=<{$dates_all[$i]}>"><{$lang_more}></a></td>
<{else}>
<td>&nbsp;</td>
<{/if}>
</tr>
<{/section}>

</table>

Finally the template is called from the show_list function in the index.php file. The following is the function excerpt from this file:

function show_list(){

global $xoopsDB, $xoopsConfig, $xoopsTheme, $xoopsModule;

$xoopsOption['template_main'] = "playdates_displaylistall.html";
include(XOOPS_ROOT_PATH."/header.php");

$myts =& MyTextSanitizer::getInstance();

$xoopsTpl->assign('lang_title', _PD_TITLE);
$xoopsTpl->assign('lang_date', _PD_DATE);
$xoopsTpl->assign('lang_time', _PD_TIME);
$xoopsTpl->assign('lang_band', _PD_BAND);
$xoopsTpl->assign('lang_venue', _PD_VENUE);
$xoopsTpl->assign('lang_location', _PD_LOCATION);
$xoopsTpl->assign('lang_info', _PD_INFO);
$xoopsTpl->assign('lang_more', _PD_MORE2);

$now = time();
$start = mktime (0,0,0,date("m", $now), date("d", $now), date("Y", $now));

$result = $xoopsDB->queryF("SELECT id, date, band, venue, city, state, event, info FROM ".$xoopsDB->prefix()."_playdates WHERE pub='1' AND (date >= '$start') ORDER BY date");

$count = mysql_num_rows($result);

//echo $count;
//exit();

while($pd_date = $xoopsDB->fetcharray($result)) {
$playdates_array = array();
$playdates_array['id'] = $pd_date['id'];
$playdates_array['band'] = stripslashes($pd_date['band']);
$playdates_array['venue'] = stripslashes($pd_date['venue']);
$playdates_array['city'] = $pd_date['city'];
$playdates_array['state'] = $pd_date['state'];
$playdates_array['event'] = $pd_date['event'];
$playdates_array['info'] = $pd_date['info'];

$tempDate = $dateArray=explode(',',strftime("%Y,%m,%d,%I,%M,%p",$pd_date['date']));
$playdates_array['date'] = date('D M j Y', mktime(0, 0, 0, $tempDate[1], $tempDate[2], $tempDate[0]));
$playdates_array['time'] = $tempDate[3].":".$tempDate[4].strtolower($tempDate[5]);

$xoopsTpl->append('dates_all', $playdates_array);
}
}

include XOOPS_ROOT_PATH."/footer.php";

I have used the debug features with no resulting errors. The problem is nothing appears on the page. The link to where I am currently testing the module (I have named Play Dates) ishttp://www.tanksplace.com/modules/playdates . Thanks in advance for any help to resolve my dilemma.




TopTop
« 1 ... 8 9 10 (11)



Login

Who's Online

252 user(s) are online (171 user(s) are browsing Support Forums)


Members: 0


Guests: 252


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits