PDA

View Full Version : something is wrong


AN-net
07-01-2004, 03:51 PM
ok its getting all the information its susposed to but then its not displaying it:(

heres my code:

$getlatest= $DB_site->query("SELECT journal_entries.entrytitle,journal_entries.entryda te,journal_entries.entry_id,
journal_entries.entrytext,journal_entries.journal_ id,journals.journalist,journals.journalist_id
FROM ".TABLE_PREFIX."journal_entries
LEFT JOIN ".TABLE_PREFIX."journals ON (journal_entries.journal_id=journals.journal_id)
WHERE journal_entries.entry_active=1 AND journal_entries.private!=1
ORDER BY journal_entries.entrydate DESC
");
$countlatest= $DB_site->num_rows($getlatest);
if($countlatest>0)
{
while($latest= $DB_site->fetch_array($getlatest))
{
$latestentrydate= vbdate($vboptions['dateformat'], $latest['entrydate'], 1);
$latestentrytime= vbdate($vboptions['timeformat'], $latest['entrydate']);
exec_switch_bg();
eval('$latestentrybits .= "' . fetch_template('journal_latestentrybits') . '";');
}
}
else
{
$latestentrybits="There are no entries.";
}

and

here is how it appears in the template:

<table class="tborder" cellspacing="$stylevar[cellspacing]" cellpadding="$stylevar[cellpadding]" border="0" align="center" width="100%">
$latestentrybits
</table>


the table its self doesnt even show up:(

Zachery
07-01-2004, 03:56 PM
Do you have a template journal_latestentrybits

?

AN-net
07-01-2004, 04:24 PM
yes i do, here is what is in the template:
<tr>
<td class="$bgclass"><div class="smallfont"><a href="journal.php?do=showentry&e=$latest[entry_id]&j=$lastest[journal_id]">$latesty[entrytitle]</a> - ($latestentrydate at $latestentrytime)<br /><span style="cursor:pointer" onclick="window.open('member.php?u=$latest[journalist_id]')">$latest[journalist]</span></div></td>
</tr>

Zachery
07-01-2004, 04:30 PM
You do have a call to printout a template at the end of the file right ?

AN-net
07-01-2004, 05:08 PM
yeah.

heres the entire block of code for that do:

if($do=="showindex")
{
$fjournals= $DB_site->query("SELECT
journals.journal_id,journals.journalname,journals. journaldesc,
journals.journalist,journals.journalist_id,journal s.lastentry,
journals.lastentry_date,journals.lastentry_id,jour nals.journalviews,
journals.journal_totalrating AS totalrating,journals.journal_totalvotes AS totalvotes,COUNT(journal_entries.entry_id) AS entries
FROM ".TABLE_PREFIX."journals
LEFT JOIN journal_entries
ON (journals.journal_id=journal_entries.journal_id AND entry_active=1)
WHERE journals.active='1'
GROUP BY journals.journal_id
");
$check= $DB_site->num_rows($fjournals);
if($check=="0")
{
$journalbits= $vbphrase['journalnojournals'];
}
else
{
while($journal= $DB_site->fetch_array($fjournals))
{
//$count= $DB_site->query_first("SELECT COUNT(*) AS entries FROM ".TABLE_PREFIX."journal_entries WHERE journal_id='".$journal['journal_id']."' AND entry_active='1'");
if(empty($journal['totalrating']) OR empty($journal['totalvotes']))
{
$rating= "0";
}
else
{
$calcrating= $journal['totalrating']/$journal['totalvotes'];
$rating= round($calcrating);
}
$lastedate= vbdate($vboptions['dateformat'], $journal['lastentry_date'], 1);
$lastetime= vbdate($vboptions['timeformat'], $journal['lastentry_date']);
exec_switch_bg();
eval('$journalbits .= "' . fetch_template('journal_journalbits') . '";');
}
}
$getlatest= $DB_site->query("SELECT journal_entries.entrytitle,journal_entries.entryda te,journal_entries.entry_id,
journal_entries.entrytext,journal_entries.journal_ id,journals.journalist,journals.journalist_id
FROM ".TABLE_PREFIX."journal_entries
LEFT JOIN ".TABLE_PREFIX."journals ON (journal_entries.journal_id=journals.journal_id)
WHERE journal_entries.entry_active=1 AND journal_entries.private!=1
ORDER BY journal_entries.entrydate DESC
");
$countlatest= $DB_site->num_rows($getlatest);
if($countlatest>0)
{
while($latest= $DB_site->fetch_array($getlatest))
{
$latestentrydate= vbdate($vboptions['dateformat'], $latest['entrydate'], 1);
$latestentrytime= vbdate($vboptions['timeformat'], $latest['entrydate']);
exec_switch_bg();
eval('$latestentrybits .= "' . fetch_template('journal_latestentrybits') . '";');
}
}
else
{
$latestentrybits="There are no entries.";
}
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('JOURNAL') . '");');
}

Zachery
07-01-2004, 05:11 PM
yeah.

heres the entire block of code for that do:

if($do=="showindex")
{
$fjournals= $DB_site->query("SELECT
journals.journal_id,journals.journalname,journals. journaldesc,
journals.journalist,journals.journalist_id,journal s.lastentry,
journals.lastentry_date,journals.lastentry_id,jour nals.journalviews,
journals.journal_totalrating AS totalrating,journals.journal_totalvotes AS totalvotes,COUNT(journal_entries.entry_id) AS entries
FROM ".TABLE_PREFIX."journals
LEFT JOIN journal_entries
ON (journals.journal_id=journal_entries.journal_id AND entry_active=1)
WHERE journals.active='1'
GROUP BY journals.journal_id
");
$check= $DB_site->num_rows($fjournals);
if($check=="0")
{
$journalbits= $vbphrase['journalnojournals'];
}
else
{
while($journal= $DB_site->fetch_array($fjournals))
{
//$count= $DB_site->query_first("SELECT COUNT(*) AS entries FROM ".TABLE_PREFIX."journal_entries WHERE journal_id='".$journal['journal_id']."' AND entry_active='1'");
if(empty($journal['totalrating']) OR empty($journal['totalvotes']))
{
$rating= "0";
}
else
{
$calcrating= $journal['totalrating']/$journal['totalvotes'];
$rating= round($calcrating);
}
$lastedate= vbdate($vboptions['dateformat'], $journal['lastentry_date'], 1);
$lastetime= vbdate($vboptions['timeformat'], $journal['lastentry_date']);
exec_switch_bg();
eval('$journalbits .= "' . fetch_template('journal_journalbits') . '";');
}
}
$getlatest= $DB_site->query("SELECT journal_entries.entrytitle,journal_entries.entryda te,journal_entries.entry_id,
journal_entries.entrytext,journal_entries.journal_ id,journals.journalist,journals.journalist_id
FROM ".TABLE_PREFIX."journal_entries
LEFT JOIN ".TABLE_PREFIX."journals ON (journal_entries.journal_id=journals.journal_id)
WHERE journal_entries.entry_active=1 AND journal_entries.private!=1
ORDER BY journal_entries.entrydate DESC
");
$countlatest= $DB_site->num_rows($getlatest);
if($countlatest>0)
{
while($latest= $DB_site->fetch_array($getlatest))
{
$latestentrydate= vbdate($vboptions['dateformat'], $latest['entrydate'], 1);
$latestentrytime= vbdate($vboptions['timeformat'], $latest['entrydate']);
exec_switch_bg();
eval('$latestentrybits .= "' . fetch_template('journal_latestentrybits') . '";');
}
}
else
{
$latestentrybits="There are no entries.";
}
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('JOURNAL') . '");');
}

This is for vB3?

where is $do defined?



try
if ($_REQUEST['do'] == 'showindex')

AN-net
07-01-2004, 06:12 PM
yeah its for vb3 and the page shows up but the stuff for latestentrybits will not show up at all. the information is retrieved cause i used echo and it all showed, its just the template info isnt:(

Modin
07-02-2004, 05:29 AM
is it a scope problem?

since the variable is defined within the if statement, it shouldn't be available outside it, so just prior to your if statement add the line

$latestentrybits = "";


I'm not completely sure how php handles scope, but in any other language this would be the case.

AN-net
07-02-2004, 03:20 PM
nope still doesnt work, it just the table and the journal_latestentrybits template wont show. the JOURNAL template shows and the information in it does too.

heres a screenshot(attached)
the red oval is where the table inside the JOURNAL template should appear and inside that table it should have the information from journal_latestentrybits.

Modin
07-02-2004, 03:29 PM
Can I see the Journal template? Thay may be where the problem arrises from, since everything else looks ok

AN-net
07-02-2004, 04:01 PM
here is the JOURNAL template:

$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<title>$vboptions[bbtitle] - vB Journal Index:</title>
$headinclude
</head>
<body>
$header
$navbar
<table border="0" align="center" width="100%">
<tr>
<td>
<table class="tborder" cellspacing="$stylevar[cellspacing]" cellpadding="$stylevar[cellpadding]" border="0" align="center" width="100%">
$recententrybits
</table>
</td>
</tr>
<tr>
<td>
<table class="tborder" cellspacing="$stylevar[cellspacing]" cellpadding="$stylevar[cellpadding]" border="0" align="center" width="100%">
<tr>
<td class="tcat" colspan="5">Journals for $vboptions[bbtitle]</td>
</tr>
<tr>
<td class="thead">Journal Name|Description</td>
<td class="thead">Views</td>
<td class="thead">Entries</td>
<td class="thead">Rating</td>
<td class="thead">Last Entry</td>
</tr>
$journalbits
</table>
</td>
</tr>
</table>
<br />
$footer
</body>
</html>

AN-net
07-03-2004, 04:17 PM
anyone?

Modin
07-04-2004, 10:30 PM
Looks like you forgot <tr> tags around $recententrybits in the JOURNAL template

try this...

$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<title>$vboptions[bbtitle] - vB Journal Index:</title>
$headinclude
</head>
<body>
$header
$navbar
<table border="0" align="center" width="100%">
<tr>
<td>
<table class="tborder" cellspacing="$stylevar[cellspacing]" cellpadding="$stylevar[cellpadding]" border="0" align="center" width="100%">
<tr>
$recententrybits
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table class="tborder" cellspacing="$stylevar[cellspacing]" cellpadding="$stylevar[cellpadding]" border="0" align="center" width="100%">
<tr>
<td class="tcat" colspan="5">Journals for $vboptions[bbtitle]</td>
</tr>
<tr>
<td class="thead">Journal Name|Description</td>
<td class="thead">Views</td>
<td class="thead">Entries</td>
<td class="thead">Rating</td>
<td class="thead">Last Entry</td>
</tr>
$journalbits
</table>
</td>
</tr>
</table>
<br />
$footer
</body>
</html>

AN-net
07-04-2004, 10:47 PM
actually journal_latestentrybits has <tr> tags in it so i wouldnt have to use <tr> tags in the JOURNAL template but thanks for the help:)

AN-net
07-05-2004, 03:26 AM
ok fixed it:) thanks all