Custom fields problem

Archive of notes and cross input on Dev versions of Coranto (1.25.1 and Older)

Moderators: Dale Ray, SrNupsen, Bluetooth, Jackanape

Custom fields problem

Postby Ace » Sun Jun 23, 2002 2:58 am

I've added a new custom field $hard in npconfig.pl.
Now I'm trying to hide the field if it has no text. So i've added the folowing code in my DoFullStoryHTML subroutine:

if ($hard ne "") {
$newshtml .= qq~ <table style="border: 2px solid #49627B">
<tr>
<td class="headline" bgcolor="#CAD0D6"><font color="#333333"><img src="../../images/hardware.gif" width="83"><br>
$hard</font></td>
</tr>
</table> ~;
}
$newshtml .= "";
}
If i put this inside the subroutine I get the following message:
An error has occurred. The exact description of the error is: Untrapped Error: syntax error at ndisplay.pl line 112, near "<" Compilation failed in require at newspro.cgi line 816.

Anybody knows why this is not working? :(
User avatar
Ace
 
Posts: 44
Joined: Thu May 02, 2002 2:01 pm
Location: Iasi, Romania

Postby LoneOwl » Sun Jun 23, 2002 3:10 am

Can you show more of the code itself? And indicate which line is line 112?
User avatar
LoneOwl
 
Posts: 1465
Joined: Sun Mar 10, 2002 2:57 am
Location: That one place, you know?

Postby Ace » Sun Jun 23, 2002 3:18 am

This is the full DoFullStoryHTML sub. If i add the code under the last line of this sub, it works perfectly.

#Full Story Formatting
sub DoFullStoryHTML {

# 3 variables created by me:
# $prevpagelink --> filename of previous page
# $nextpagelink --> filename of next page
# $numpage --> number of current page
$prevpagelink = $prevhref ? qq~<A HREF="$prevhref"><font face="Arial">Pagina anterioara &lt;&lt;</font></A>~ : q~~;
$nextpagelink = $nexthref ? qq~<A HREF="$nexthref"><font face="Arial">&gt;&gt; Pagina urmatoare</font></A>~ : q~~;

if (!$prevhref && !$nexthref) { $prevpagelink = qq~<A HREF="/"><font face="Arial">Pagina principala</font></A>~; }
if (!$prevhref && $nexthref) { $prevpagelink = qq~<A HREF="/"><font face="Arial">Pagina principala &lt;&lt;</font></A>~; }
if ($prevhref && !$nexthref) { $nextpagelink = qq~<A HREF="/"><font face="Arial">&gt;&gt; Pagina principala</font></A>~; }
$numpage = ($filenum == 1 && !$nexthref) ? "": $filenum;


$newshtml = qq~


<table width="630" border="0" cellpadding="1" cellspacing="0" bgcolor="EFEFEF">
<tr>
<td class="headline" bgcolor="DEE3E7" colspan="2" height="99">
<table border="0" cellpadding="0" cellspacing="0" width="100%" background="http://www.pixelrage.ro/images/info_back.gif">
<tr>
<td width="1%" bgcolor="DEE3E7" valign="top"><img src="http://www.pixelrage.ro/images/n-infobox.gif" width="17" height="120"></td>
<td width="413" class="headline"><img src="http://www.pixelrage.ro/images/gaming/$image" border ="1" width="120" height="120" align="left" alt="$newssubject"><font face="Trebuchet MS" size="3" color="#336699"><b>$newssubject</b></font>
<br>
<br>
<font face="Arial" color="#333333">Scris de <b>$author</b> l $newsdate<br>
<b>Producator:</b> $producer<br>
<b>Site oficial:</b> <a href="$site" target="_blank"><font face="Arial">$site</font></a><br>
<b>Gen:</b> $genre<br>
<b>Data lansare:</b> $releasedate</font></td>
<td width="200">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="headline" bgcolor="DEE3E7" colspan="2" height="5"></td>
</tr>
<tr>
<td class="text_1" bgcolor="DEE3E7" width="350" nowrap valign="top">
<table border="0" cellpadding="0" cellspacing="0" width="345">
<tr>
<td rowspan="4" width="32"><img src="http://www.pixelrage.ro/images/nota/notap_1/$nota1.gif"></td>
<td rowspan="4" width="10"><img src="http://www.pixelrage.ro/images/nota/notap_2/$nota2.gif"></td>
<td width="303"><img src="http://www.pixelrage.ro/images/nota/grafica/$notagrafica.gif"></td>
</tr>
<tr>
<td width="303"><img src="http://www.pixelrage.ro/images/nota/sunet/$notasunet.gif"></td>
</tr>
<tr>
<td width="303"><img src="http://www.pixelrage.ro/images/nota/gameplay/$notagameplay.gif"></td>
</tr>
<tr>
<td width="303"><img src="http://www.pixelrage.ro/images/nota/resurse/$notaresurse.gif"></td>
</tr>
</table>
</td>
<td class="headline" bgcolor="DEE3E7" width="280" valign="top" nowrap rowspan="2"><i><font color="#333333">$newssnippit</font></i>
</td>
</tr>
<tr>
<td class="headline" bgcolor="DEE3E7" width="350" nowrap valign="top">
if ($hard ne "") {
$newshtml .= qq~ <table style="border: 2px solid #49627B">
<tr>
line 112 <td class="headline" bgcolor="#CAD0D6"><font color="#333333"><img src="http://www.pixelrage.ro/images/hardware.gif" width="83"><br>
$hard</font></td>
</tr>
</table> ~;
}
$newshtml .= "</p>";
}


</td>
</tr>
<tr>
<td class="text_1" bgcolor="DEE3E7" colspan="2" nowrap valign="top">
<hr width="100%" size="1" color="#49627B">
</td>
</tr>
<tr>
<td class="text_1" bgcolor="DEE3E7" colspan="2"> <b><font face="Arial" color="#333333">$stattitle
</font></b><b><font face="Arial">$nextpagelink<br>
</font></b> <br>
$newstext<br>
<br>
<b><font face="Arial">$prevpagelink</font></b> <b><font face="Arial" color="#333333">
$stattitle </font></b><b><font face="Arial">$nextpagelink</font></b><br>
<b><font face="Arial" color="#333333">(Pagina $filenum din $statmax)</font></b>
</td>
</tr>
<tr>
<td class="headline" bgcolor="#DEE3E7" colspan="2">
<div align="center"> </div>
</td>
</tr>
</table>

~;
if ($hard ne "") {
$newshtml .= qq~ <table style="border: 2px solid #49627B">
<tr>
<td class="headline" bgcolor="#CAD0D6"><font color="#333333"><img src="http://www.pixelrage.ro/images/hardware.gif" width="83"><br>
$hard</font></td>
</tr>
</table>

> ~;
}
$newshtml .= "";
}

User avatar
Ace
 
Posts: 44
Joined: Thu May 02, 2002 2:01 pm
Location: Iasi, Romania

Postby LoneOwl » Sun Jun 23, 2002 3:30 am

Add
Code: Select all
~;
before the first if.
User avatar
LoneOwl
 
Posts: 1465
Joined: Sun Mar 10, 2002 2:57 am
Location: That one place, you know?

Postby Ace » Sun Jun 23, 2002 3:48 am

Doesn't work. Now I get:
" An error has occurred. The exact description of the error is: Untrapped Error: syntax error at ndisplay.pl line 123, near "" Unmatched right curly bracket at ndisplay.pl line 148, at end of line Compilation failed in require at newspro.cgi line 816.

The whole code again:
#Full Story Formatting
sub DoFullStoryHTML {

# 3 variables created by me:
# $prevpagelink --> filename of previous page
# $nextpagelink --> filename of next page
# $numpage --> number of current page
$prevpagelink = $prevhref ? qq~<A HREF="$prevhref"><font face="Arial">Pagina anterioara &lt;&lt;</font></A>~ : q~~;
$nextpagelink = $nexthref ? qq~<A HREF="$nexthref"><font face="Arial">&gt;&gt; Pagina urmatoare</font></A>~ : q~~;

if (!$prevhref && !$nexthref) { $prevpagelink = qq~<A HREF="/"><font face="Arial">Pagina principala</font></A>~; }
if (!$prevhref && $nexthref) { $prevpagelink = qq~<A HREF="/"><font face="Arial">Pagina principala &lt;&lt;</font></A>~; }
if ($prevhref && !$nexthref) { $nextpagelink = qq~<A HREF="/"><font face="Arial">&gt;&gt; Pagina principala</font></A>~; }
$numpage = ($filenum == 1 && !$nexthref) ? "": $filenum;


$newshtml = qq~


<table width="630" border="0" cellpadding="1" cellspacing="0" bgcolor="EFEFEF">
<tr>
<td class="headline" bgcolor="DEE3E7" colspan="2" height="99">
<table border="0" cellpadding="0" cellspacing="0" width="100%" background="http://www.pixelrage.ro/images/info_back.gif">
<tr>
<td width="1%" bgcolor="DEE3E7" valign="top"><img src="http://www.pixelrage.ro/images/n-infobox.gif" width="17" height="120"></td>
<td width="413" class="headline"><img src="http://www.pixelrage.ro/images/gaming/$image" border ="1" width="120" height="120" align="left" alt="$newssubject"><font face="Trebuchet MS" size="3" color="#336699"><b>$newssubject</b></font>
<br>
<br>
<font face="Arial" color="#333333">Scris de <b>$author</b> l $newsdate<br>
<b>Producator:</b> $producer<br>
<b>Site oficial:</b> <a href="$site" target="_blank"><font face="Arial">$site</font></a><br>
<b>Gen:</b> $genre<br>
<b>Data lansare:</b> $releasedate</font></td>
<td width="200">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="headline" bgcolor="DEE3E7" colspan="2" height="5"></td>
</tr>
<tr>
<td class="text_1" bgcolor="DEE3E7" width="350" nowrap valign="top">
<table border="0" cellpadding="0" cellspacing="0" width="345">
<tr>
<td rowspan="4" width="32"><img src="http://www.pixelrage.ro/images/nota/notap_1/$nota1.gif"></td>
<td rowspan="4" width="10"><img src="http://www.pixelrage.ro/images/nota/notap_2/$nota2.gif"></td>
<td width="303"><img src="http://www.pixelrage.ro/images/nota/grafica/$notagrafica.gif"></td>
</tr>
<tr>
<td width="303"><img src="http://www.pixelrage.ro/images/nota/sunet/$notasunet.gif"></td>
</tr>
<tr>
<td width="303"><img src="http://www.pixelrage.ro/images/nota/gameplay/$notagameplay.gif"></td>
</tr>
<tr>
<td width="303"><img src="http://www.pixelrage.ro/images/nota/resurse/$notaresurse.gif"></td>
</tr>
</table>
</td>
<td class="headline" bgcolor="DEE3E7" width="280" valign="top" nowrap rowspan="2"><i><font color="#333333">$newssnippit</font></i>
</td>
</tr>
<tr>
<td class="headline" bgcolor="DEE3E7" width="350" nowrap valign="top">
~;
if ($hard ne "") {
$newshtml .= qq~ <table style="border: 2px solid #49627B">
<tr>
<td class="headline" bgcolor="#CAD0D6"><font color="#333333"><img

src="http://www.pixelrage.ro/images/hardware.gif" width="83"><br>
$hard</font></td>
</tr>
</table>

> ~;
}
$newshtml .= "";
}
</td>
line 123 </tr>
<tr>
<td class="text_1" bgcolor="DEE3E7" colspan="2" nowrap valign="top">
<hr width="100%" size="1" color="#49627B">
</td>
</tr>
<tr>
<td class="text_1" bgcolor="DEE3E7" colspan="2"> <b><font face="Arial" color="#333333">$stattitle
</font></b><b><font face="Arial">$nextpagelink<br>
</font></b> <br>
$newstext<br>
<br>
<b><font face="Arial">$prevpagelink</font></b> <b><font face="Arial" color="#333333">
$stattitle </font></b><b><font face="Arial">$nextpagelink</font></b><br>
<b><font face="Arial" color="#333333">(Pagina $filenum din $statmax)</font></b>
</td>
</tr>
<tr>
<td class="headline" bgcolor="#DEE3E7" colspan="2">
<div align="center"> </div>
</td>
</tr>
</table>

~;
line 148 }
User avatar
Ace
 
Posts: 44
Joined: Thu May 02, 2002 2:01 pm
Location: Iasi, Romania

Postby LoneOwl » Sun Jun 23, 2002 3:56 am

Try this.
Code: Select all
#Full Story Formatting
sub DoFullStoryHTML {

# 3 variables created by me:
# $prevpagelink --> filename of previous page
# $nextpagelink --> filename of next page
# $numpage --> number of current page
$prevpagelink = $prevhref ? qq~<A HREF="$prevhref"><font face="Arial">Pagina anterioara &lt;&lt;</font></A>~ : q~~;
$nextpagelink = $nexthref ? qq~<A HREF="$nexthref"><font face="Arial">&gt;&gt; Pagina urmatoare</font></A>~ : q~~;

if (!$prevhref && !$nexthref) { $prevpagelink = qq~<A HREF="/"><font face="Arial">Pagina principala</font></A>~; }
if (!$prevhref && $nexthref) { $prevpagelink = qq~<A HREF="/"><font face="Arial">Pagina principala &lt;&lt;</font></A>~; }
if ($prevhref && !$nexthref) { $nextpagelink = qq~<A HREF="/"><font face="Arial">&gt;&gt; Pagina principala</font></A>~; }
$numpage = ($filenum == 1 && !$nexthref) ? "": $filenum;

$newshtml = qq~

<table width="630" border="0" cellpadding="1" cellspacing="0" bgcolor="EFEFEF">
<tr>
<td class="headline" bgcolor="DEE3E7" colspan="2" height="99">
<table border="0" cellpadding="0" cellspacing="0" width="100%" background="http://www.pixelrage.ro/images/info_back.gif">
<tr>
<td width="1%" bgcolor="DEE3E7" valign="top"><img src="http://www.pixelrage.ro/images/n-infobox.gif" width="17" height="120"></td>
<td width="413" class="headline"><img src="http://www.pixelrage.ro/images/gaming/$image" border ="1" width="120" height="120" align="left" alt="$newssubject"><font face="Trebuchet MS" size="3" color="#336699"><b>$newssubject</b></font>
<br>
<br>
<font face="Arial" color="#333333">Scris de <b>$author</b> l $newsdate<br>
<b>Producator:</b> $producer<br>
<b>Site oficial:</b> <a href="$site" target="_blank"><font face="Arial">$site</font></a><br>
<b>Gen:</b> $genre<br>
<b>Data lansare:</b> $releasedate</font></td>
<td width="200">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="headline" bgcolor="DEE3E7" colspan="2" height="5"></td>
</tr>
<tr>
<td class="text_1" bgcolor="DEE3E7" width="350" nowrap valign="top">
<table border="0" cellpadding="0" cellspacing="0" width="345">
<tr>
<td rowspan="4" width="32"><img src="http://www.pixelrage.ro/images/nota/notap_1/$nota1.gif"></td>
<td rowspan="4" width="10"><img src="http://www.pixelrage.ro/images/nota/notap_2/$nota2.gif"></td>
<td width="303"><img src="http://www.pixelrage.ro/images/nota/grafica/$notagrafica.gif"></td>
</tr>
<tr>
<td width="303"><img src="http://www.pixelrage.ro/images/nota/sunet/$notasunet.gif"></td>
</tr>
<tr>
<td width="303"><img src="http://www.pixelrage.ro/images/nota/gameplay/$notagameplay.gif"></td>
</tr>
<tr>
<td width="303"><img src="http://www.pixelrage.ro/images/nota/resurse/$notaresurse.gif"></td>
</tr>
</table>
</td>
<td class="headline" bgcolor="DEE3E7" width="280" valign="top" nowrap rowspan="2"><i><font color="#333333">$newssnippit</font></i>
</td>
</tr>
<tr>
<td class="headline" bgcolor="DEE3E7" width="350" nowrap valign="top">
~;
if ($hard ne "") {
$newshtml .= qq~ <table style="border: 2px solid #49627B">
<tr>
<td class="headline" bgcolor="#CAD0D6"><font color="#333333"><img

src="http://www.pixelrage.ro/images/hardware.gif" width="83"><br>
$hard</font></td>
</tr>
</table>

> ~;
}
$newshtml .= qq~
</td>
</tr>
<tr>
<td class="text_1" bgcolor="DEE3E7" colspan="2" nowrap valign="top">
<hr width="100%" size="1" color="#49627B">
</td>
</tr>
<tr>
<td class="text_1" bgcolor="DEE3E7" colspan="2"> <b><font face="Arial" color="#333333">$stattitle
</font></b><b><font face="Arial">$nextpagelink<br>
</font></b> <br>
$newstext<br>
<br>
<b><font face="Arial">$prevpagelink</font></b> <b><font face="Arial" color="#333333">
$stattitle </font></b><b><font face="Arial">$nextpagelink</font></b><br>
<b><font face="Arial" color="#333333">(Pagina $filenum din $statmax)</font></b>
</td>
</tr>
<tr>
<td class="headline" bgcolor="#DEE3E7" colspan="2">
<div align="center"> </div>
</td>
</tr>
</table>

~;
}

User avatar
LoneOwl
 
Posts: 1465
Joined: Sun Mar 10, 2002 2:57 am
Location: That one place, you know?

Postby Ace » Sun Jun 23, 2002 4:04 am

Thanks a lot, man. Now it works perfectly. :)
User avatar
Ace
 
Posts: 44
Joined: Thu May 02, 2002 2:01 pm
Location: Iasi, Romania


Return to Coranto Development Archives -- 1.25.1 and Older

Who is online

Users browsing this forum: No registered users and 1 guest

cron