Helpfiles Mod

This forum is now closed as part of retiring phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.

Helpfiles Mod

Postby smsulliva » Fri Jan 12, 2007 7:45 pm

I am trying to further integrate some data tables into phpbb and need help how to write this helpfile mod. Our old php page worked and here is the code. Can someone help me convert this to use phpBB templates.
Code: Select all
<?php
//check for passed variables
$item = ''; //variable to hold the individual helpfile currently in view
if(isset($_GET['item']))
{
   $item = $_GET['item'];
}

$category = ''; //variable to hold the selected category to be listed
if(isset($_GET['category']))
{
   $category = $_GET['category'];
}

$letter = ''; //variable to hold the selected letter to be listed
if(isset($_GET['letter']))
{
   $letter = $_GET['letter'];
}

$keyword = ''; //variable to hold the entered search criteria to be listed
if(isset($_GET['keyword']))
{
   $keyword = $_GET['keyword'];
}

?>
<div id="content">
<div align="center">
<br>
<?php
//if an item has been chosen show the individual helpfile
//--------------------------------------------------------------------------------------------------//
if($item != '')
{
   //get the details of the selected helpfile
   $helpQry = "SELECT * FROM DB1.helpfiles WHERE name = \"".$item."\"";
   $helpRes = mysql_query($helpQry) or die(mysql_error());
   $helpArr = mysql_fetch_array($helpRes);
   
   echo("<h3 id='help' title='help'>".$item."</h3>");
   echo("<table align='center'>");
   echo("<tr><th align='left'>".$item."</th></tr>");
   echo("<tr><td align='left'>".parse_string($helpArr['entry'])."</td></tr>");
   echo("<tr><th align='left'>Related entries:");
   
   //split the related entries string into seperate strings to be used as links
   $related_entries_array = explode(" ", $helpArr['related_entries']);
   
   //write a link for each related entry
   for($i=0;$i<count($related_entries_array);$i++)
         {
                 echo(" <a href='index.php?location=help&item=".$related_entries_array[$i]."'>".parse_string(
                         $related_entries_array[$i])."</a>");
         }
   echo("</th></tr>");
   echo("<tr><td>&nbsp;</td></tr>");
   echo("</table>");
   echo("<hr>");
}
//------------------------------------------------------------------------------------------------//

//if a category has been chosen show the helpfiles for that category
//-----------------------------------------------------------------------------------------------//
if($category != '')
{
   //get all of the helpfiles for this category
   $fileQry = "SELECT distinct name FROM DB1.helpfiles WHERE category = \"".$category."\""
      ." AND required_level = '0' ORDER BY name";
   $fileRes = mysql_query($fileQry) or die(mysql_error());
   
   echo("<h3 id='help' title='help'>".$category."</h3>");
   echo("<table align='center'>");
   echo("<tr>");

   $i = 0;//variable to count the categories written on this row
   while($fileArr = mysql_fetch_array($fileRes))
   {
      // if this is the first item of the row, write row start tags
      if($i == 0)
      {
         echo("<tr>");
      }
      //write the category link
      echo("<td align='center' width='100'><a href='index.php?location=help&item="
         .$fileArr['name']."'>");
      echo($fileArr['name']);
      echo("</a></td>");
   
      $i++; //incriment count
      
      //if this is the fourth item of the row, start a new row
      if($i==4)
      {
         echo("</tr>");
         $i = 0;// reset count to zero for the next row
      }
   }
   echo("<tr><td>&nbsp;</td></tr>");
   echo("</table>");
   echo("<hr>");
}
//------------------------------------------------------------------------------------------------//

//if a letter has been chosen show the helpfiles beginning with that letter
//-----------------------------------------------------------------------------------------------//
if($letter != '')
{
   //get all of the helpfiles for this letter
   $fileQry = "SELECT distinct name FROM DB1.helpfiles WHERE SUBSTRING(name, 1, 1) = \"".$letter."\""
      ." AND category != 'Staff'"
      ." AND category != 'Building'"
      ." AND required_level = '0' ORDER BY name";
   $fileRes = mysql_query($fileQry) or die(mysql_error());
   
   echo("<h3 id='help' title='help'>Helpfiles beginning with ".$letter."</h3>");
   echo("<table align='center'>");
   echo("<tr>");

   $i = 0;//variable to count the helpfiles written on this row
   while($fileArr = mysql_fetch_array($fileRes))
   {
      // if this is the first item of the row, write row start tags
      if($i == 0)
      {
         echo("<tr>");
      }
      //write the category link
      echo("<td align='center' width='100'><a href='index.php?location=help&item="
         .$fileArr['name']."'>");
      echo($fileArr['name']);
      echo("</a></td>");
   
      $i++; //incriment count
      
      //if this is the fourth item of the row, start a new row
      if($i==4)
      {
         echo("</tr>");
         $i = 0;// reset count to zero for the next row
      }
   }
   echo("<tr><td>&nbsp;</td></tr>");
   echo("</table>");
   echo("<hr>");
}
//------------------------------------------------------------------------------------------------//

//if a keyword has been entered show the matching helpfiles
//-----------------------------------------------------------------------------------------------//
if($keyword != '')
{
   //get all of the helpfiles for this keyword
   $fileQry = "SELECT distinct name FROM DB1.helpfiles WHERE LOCATE(\"".$keyword."\", name)"
      ." AND category != 'Staff'"
      ." AND category != 'Building'"
      ." AND required_level = '0' ORDER BY name";
   $fileRes = mysql_query($fileQry) or die(mysql_error());
   
   echo("<h3 id='help' title='help'>Search Results For <i>".$keyword."</i></h3>");
   echo("<table align='center'>");
   echo("<tr>");

   $i = 0;//variable to count the helpfiles written on this row
   $count = 0;
   while($fileArr = mysql_fetch_array($fileRes))
   {
      // if this is the first item of the row, write row start tags
      if($i == 0)
      {
         echo("<tr>");
      }
      //write the category link
      echo("<td align='center' width='100'><a href='index.php?location=help&item="
         .$fileArr['name']."'>");
      echo($fileArr['name']);
      echo("</a></td>");
   
      $i++; //incriment count
      $count++;
      
      //if this is the fourth item of the row, start a new row
      if($i==4)
      {
         echo("</tr>");
         $i = 0;// reset count to zero for the next row
      }
   }
   
   //if no helpfiles have been written, there are no matches, so display an error message
   if($count == 0)
   {
      echo("<tr><td>No helpfiles could be found to match the criteria you entered.</td></tr>");
   }
   
   echo("<tr><td>&nbsp;</td></tr>");
   echo("</table>");
   echo("<hr>");
}
//------------------------------------------------------------------------------------------------//

//show the main contents of the helpfiles
//-------------------------------------------------------------------------------------------------//
//get a list of categories to display as links
   $catQry = "SELECT distinct category FROM DB1.helpfiles WHERE category != 'Staff'"
      ." AND category != 'Building'"
      ." AND required_level = '0' ORDER BY category";
   $catRes = mysql_query($catQry) or die(mysql_error());
   
   //Write the categorical index
   echo("<h3 id='help' title='help'>Categorical Index</h3>");
   echo("<table align='center'>");
   echo("<tr><td>&nbsp;</td></tr>");
   echo("<tr>");

   $i = 0;//variable to count the categories written on this row
   while($catArr = mysql_fetch_array($catRes))
   {
      // if this is the first item of the row, write row start tags
      if($i == 0)
      {
         echo("<tr>");
      }
      //write the category link
      echo("<td align='center' width='100'><a href='index.php?location=help&category="
         .$catArr['category']."'>");
      echo($catArr['category']);
      echo("</a></td>");
   
      $i++; //incriment count
      
      //if this is the fourth item of the row, start a new row
      if($i==4)
      {
         echo("</tr>");
         $i = 0;// reset count to zero for the next row
      }
   }
   
   echo("</table>");
   
   //write the alphabetical index
   echo("<h3 id='help' title='help'>Alphabetical Index</h3>");
   $alphabet = array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L"
      ," M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z");
   echo("<table align='center'>");
   echo("<tr>");
   for($n=0;$n<count($alphabet);$n++)
   {
      echo("<td width='5'><a href='index.php?location=help&letter="
         .$alphabet[$n]."'>".$alphabet[$n]."</a></td>");
   }
   echo("</tr>");
   echo("</table>");
   
   //write the search index
   echo("<h3 id='help' title='help'>Helpfile Search</h3>");
   echo("<Form name='searchForm' method='get' action=".$_SERVER[PHP_SELF].">");
   echo("<input type='hidden' name='location' value='help'>");
   echo("<table align='center'>");
   echo("<tr><td><input type='text' size='30' name='keyword'></td></tr>");
   echo("<tr><td><button type='submit'>Search</button></td></tr>");
   echo("</table>");
   echo("</form>");
//-----------------------------------------------------------------------------------------------//

?>

</div>

<div align="center">
<h3 id="help" title="help">Featured helpfile</h3>
<?php
//This section of code selects a random helpfile from the database at every page load

//array to hold names of helpfiles
$namesArr = array();
$entryArr = array();
$count = 0;

//get the details of helpfiles in the database and count them
$numQry = "SELECT name, entry FROM DB1.helpfiles WHERE category != 'Staff'"
      ." AND category != 'Building'"
      ." AND required_level = '0'";
$numRes = mysql_query($numQry) or die(mysql_error());
while($numArr = mysql_fetch_array($numRes))
{
   //add the names to the array
   array_push($namesArr, $numArr['name']);
   //add the entries to the array
   array_push($entryArr, $numArr['entry']);
   $count++; //incriment the count of entries
}

//randomise a number between 1 and the number of helpfiles in the database
$number = rand(1, $count);

//write the data using the randomised number
echo("<table align='center'>");
echo("<tr><th align='left'>".$namesArr[$number]."</th></tr>");
echo("<tr><td align='left'>".parse_string($entryArr[$number])."</td></tr>");
echo("</table>");
?>
</div>

</div>
<?php
//String Parsing function -  Remove #n and replaces with <b>or</b>
function parse_string($string_to_parse)
{
   //check the string for #0 and replace them with </b>
   $string_to_parse = str_replace("#0","</b>", $string_to_parse);
   
   //check the string for any #n remaining <b>
   $string_to_parse = str_replace("#1","<b>", $string_to_parse);
   $string_to_parse = str_replace("#2","<b>", $string_to_parse);
   $string_to_parse = str_replace("#3","<b>", $string_to_parse);
   $string_to_parse = str_replace("#4","<b>", $string_to_parse);
   $string_to_parse = str_replace("#5","<b>", $string_to_parse);
   $string_to_parse = str_replace("#6","<b>", $string_to_parse);
   $string_to_parse = str_replace("#7","<b>", $string_to_parse);
   $string_to_parse = str_replace("#8","<b>", $string_to_parse);
   $string_to_parse = str_replace("#9","<b>", $string_to_parse);
   $string_to_parse = str_replace("(null)"," ", $string_to_parse);
   
   //insert line breaks where needed
   $string_to_parse = nl2br($string_to_parse);
   
   //return the parsed string
   return $string_to_parse;
}
?>
smsulliva
Registered User
 
Posts: 49
Joined: Mon Aug 02, 2004 6:15 pm

Postby smsulliva » Sat Jan 13, 2007 4:09 pm

Anybody want to give this one a try?
smsulliva
Registered User
 
Posts: 49
Joined: Mon Aug 02, 2004 6:15 pm

Postby smsulliva » Thu Jan 18, 2007 6:39 pm

I can't believe anybody would be able to give me some suggestions on this.
smsulliva
Registered User
 
Posts: 49
Joined: Mon Aug 02, 2004 6:15 pm

Postby RMcGirr83 » Thu Jan 18, 2007 7:30 pm

you would need to split the echos out into a tpl file and move the functions into includes/functions.php

shouldn't be too bad look at the blank template mod for more ideas.
RMcGirr83
Jr. MOD Validator
 
Posts: 8077
Joined: Wed Jun 22, 2005 4:33 pm
Location: East Lyme, CT

Postby smsulliva » Thu Jan 18, 2007 7:59 pm

There isn't any functions in this.
I have tried to move that and the .item isn't working even the $category.

Please someone give me an example. Just learning here. :)
smsulliva
Registered User
 
Posts: 49
Joined: Mon Aug 02, 2004 6:15 pm

Postby RMcGirr83 » Thu Jan 18, 2007 8:11 pm

this is a function

Code: Select all
function parse_string($string_to_parse)
{
   //check the string for #0 and replace them with </b>
   $string_to_parse = str_replace("#0","</b>", $string_to_parse);
   
   //check the string for any #n remaining <b>
   $string_to_parse = str_replace("#1","<b>", $string_to_parse);
   $string_to_parse = str_replace("#2","<b>", $string_to_parse);
   $string_to_parse = str_replace("#3","<b>", $string_to_parse);
   $string_to_parse = str_replace("#4","<b>", $string_to_parse);
   $string_to_parse = str_replace("#5","<b>", $string_to_parse);
   $string_to_parse = str_replace("#6","<b>", $string_to_parse);
   $string_to_parse = str_replace("#7","<b>", $string_to_parse);
   $string_to_parse = str_replace("#8","<b>", $string_to_parse);
   $string_to_parse = str_replace("#9","<b>", $string_to_parse);
   $string_to_parse = str_replace("(null)"," ", $string_to_parse);
   
   //insert line breaks where needed
   $string_to_parse = nl2br($string_to_parse);
   
   //return the parsed string
   return $string_to_parse;
}
RMcGirr83
Jr. MOD Validator
 
Posts: 8077
Joined: Wed Jun 22, 2005 4:33 pm
Location: East Lyme, CT

Postby smsulliva » Thu Jan 18, 2007 8:56 pm

I moved the function to the includes/functions.php file (I can't believe I didn't see that one)

I looked at the Blank Template Mod again. I used that for a bunch of my other pages, that just have content on them, but no database interaction. The MOD doesn't really give much for examples.
smsulliva
Registered User
 
Posts: 49
Joined: Mon Aug 02, 2004 6:15 pm

Postby smsulliva » Fri Jan 19, 2007 1:00 am

Started to convert this to a mod and here is part of what I have. I think I am messing up somewhere.
Code: Select all
<?php

// standard hack prevent
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_HELP);
init_userprefs($userdata);
//
// End session management
//

// set page title
$page_title = $lang['Help']; // You'll have to set this in a $lang file somewhere

// standard page header
include($phpbb_root_path . 'includes/page_header.'.$phpEx)

// assign template
$template->set_filenames(array(
        'body' => 'help_body.tpl')
);

//check for passed variables
$item = ''; //variable to hold the individual helpfile currently in view
if(isset($_GET['item']))
{
   $item = $_GET['item'];
}

$category = ''; //variable to hold the selected category to be listed
if(isset($_GET['category']))
{
   $category = $_GET['category'];
}

$letter = ''; //variable to hold the selected letter to be listed
if(isset($_GET['letter']))
{
   $letter = $_GET['letter'];
}

$keyword = ''; //variable to hold the entered search criteria to be listed
if(isset($_GET['keyword']))
{
   $keyword = $_GET['keyword'];
}

if($item != '') {
   $helpQry = "SELECT * FROM DB1.helpfiles WHERE name = \"".$item."\"";
   $helpRes = mysql_query($helpQry) or die(mysql_error());
   $helpArr = mysql_fetch_array($helpRes);
   
   $template->assign_block_vars('switch_item',
      array(  'ITEM' => $item,
            'HELP_ARRAY' => parse_string($helpArr['entry']) )
   );
   
               'RELATED_ENTRIES' => $related_entries_array = explode(" ", $helpArr['related_entries']),

for($i=0;$i<count($related_entries_array);$i++)
         {
     $template->assign_block_vars('my_loop',array( 'THIS_LOOP' => <a href='index.php?location=help&item=".$related_entries_array[$i]."'>".parse_string(
                         $related_entries_array[$i])."</a>),
                                                   'TOTAL_LOOPS' => $n
                                                 )
                                   );               
               
         }


} //END IF


** MORE GOES HERE **




$template->pparse('body');

// standard page footer
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);

?>



Beginning tpl file
Code: Select all
<html>
<!-- BEGIN switch_item -->
<h3>{ITEM}</h3>

   echo("<tr><th align='left'>".$item."</th></tr>");
   echo("<tr><td align='left'>".parse_string($helpArr['entry'])."</td></tr>");
   echo("<tr><th align='left'>Related entries:");


<table>
<tr>
   <td class="row1">{ITEM}</td>
</tr>
  <tr>
   <td class="row1">{HELP_ARRAY}</td>
</tr>
    <!-- BEGIN my_loop -->
<tr>
   <th>Related entries:  {RELATED_ENTRIES}</th>
   <!-- END my_loop -->
</tr>
</table>
  <!-- END switch_item -->

Does that look right so far.
smsulliva
Registered User
 
Posts: 49
Joined: Mon Aug 02, 2004 6:15 pm

Postby Brf » Fri Jan 19, 2007 1:11 am

The items in "switch_item" will need to be qualified like this:

Code: Select all
{switch_item.ITEM}
{switch_item.HELP_ARRAY}


You are defining 'RELATED_ENTRIES' as a regular scaler, but you includes it two deep in loops in your template....

since 'my_loop' is within another switch, it will have to be defined as:

Code: Select all
$template->assign_block_vars('switch_item.my_loop'


and you would have to define:
Code: Select all
{switch_item.my_loop.THIS_LOOP}
{switch_item.my_loop.TOTAL_LOOPS}
within it, in the template
User avatar
Brf
Support Team Member
Support Team Member
 
Posts: 31192
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}

Postby smsulliva » Fri Jan 19, 2007 1:52 pm

Brf wrote:You are defining 'RELATED_ENTRIES' as a regular scaler, but you includes it two deep in loops in your template....

since 'my_loop' is within another switch, it will have to be defined as:


Where do I put my RELATED_ENTRIES in my function


Thanks for the input. Does it look like that what I am doing is going to work from the above real code area?

Can you tell me how you would suggest doing the <href> link in the loop?

I will try what you suggested. I am hoping I am on the right track. :)
smsulliva
Registered User
 
Posts: 49
Joined: Mon Aug 02, 2004 6:15 pm

Postby Brf » Fri Jan 19, 2007 5:09 pm

You need to get rid of this line:

Code: Select all
              'RELATED_ENTRIES' => $related_entries_array = explode(" ", $helpArr['related_entries']),


It is hanging out there by itself, not even in a function.

You need to put these:

Code: Select all
{switch_item.my_loop.THIS_LOOP}
{switch_item.my_loop.TOTAL_LOOPS}


In your template instead of RELATED_ITEMS, since that is what your php is trying to fill.
User avatar
Brf
Support Team Member
Support Team Member
 
Posts: 31192
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}

Postby smsulliva » Fri Jan 19, 2007 6:51 pm

Well here is what I got. Can someone look it over.
I haven't tried it yet, but I thought another set of eyes might be nice.
The php code
Code: Select all
<?php

// standard hack prevent
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_HELP);
init_userprefs($userdata);
//
// End session management
//

// set page title
$page_title = $lang['Help']; // You'll have to set this in a $lang file somewhere

// standard page header
include($phpbb_root_path . 'includes/page_header.'.$phpEx);

// assign template
$template->set_filenames(array(
        'body' => 'help_body.tpl')
);

//check for passed variables
$item = ''; //variable to hold the individual helpfile currently in view
if(isset($_GET['item']))
{
   $item = $_GET['item'];
}

$category = ''; //variable to hold the selected category to be listed
if(isset($_GET['category']))
{
   $category = $_GET['category'];
}

$letter = ''; //variable to hold the selected letter to be listed
if(isset($_GET['letter']))
{
   $letter = $_GET['letter'];
}

$keyword = ''; //variable to hold the entered search criteria to be listed
if(isset($_GET['keyword']))
{
   $keyword = $_GET['keyword'];
}

//if an item has been chosen show the individual helpfile
//--------------------------------------------------------------------------------------------------//
if($item != '')
{
   //get the details of the selected helpfile
   $helpQry = "SELECT * FROM DB1.helpfiles WHERE name = \"".$item."\"";
   $helpRes = mysql_query($helpQry) or die(mysql_error());
   $helpArr = mysql_fetch_array($helpRes);

   $template->assign_block_vars('switch_item',
      array( 'ITEM' => $item,
            'HELP_ARRAY' => parse_string($helpArr['entry']) )
   );

   //split the related entries string into seperate strings to be used as links
   $related_entries_array = explode(" ", $helpArr['related_entries']);
   
   //write a link for each related entry
   for ($i = 0; $i < count($related_entries_array); $i++ )
   {
       $template->assign_block_vars('related_link', array( 'U_RELATED' => $server_url . '?' . "location=help&item=" .$related_entries_array[$i]."'>".parse_string(
                         $related_entries_array[$i] ) ) );
   }
} //END ITEM IF

//------------------------------------------------------------------------------------------------//

//if a category has been chosen show the helpfiles for that category
//-----------------------------------------------------------------------------------------------//
if($category != '')
{
   //get all of the helpfiles for this category
   $fileQry = "SELECT distinct name FROM DB1.helpfiles WHERE category = \"".$category."\""
      ." AND required_level = '0' ORDER BY name";
   $fileRes = mysql_query($fileQry) or die(mysql_error());
   
   $template->assign_block_vars('switch_category',
     array( 'CATEGORY' => $category ) );

   $i = 0;//variable to count the categories written on this row
   while($fileArr = mysql_fetch_array($fileRes))
   {

       $template->assign_block_vars('category_row',
          array( 'U_CATEGORY' => $server_url . '?' . "location=help&item=" .$fileArr['name']."'>".$fileArr['name'] ) );
   }
} //END CATEGORY IF

//------------------------------------------------------------------------------------------------//

//if a letter has been chosen show the helpfiles beginning with that letter
//-----------------------------------------------------------------------------------------------//
if($letter != '')
{
   //get all of the helpfiles for this letter
   $LetterQry = "SELECT distinct name FROM DB1.helpfiles WHERE SUBSTRING(name, 1, 1) = \"".$letter."\""
      ." AND category != 'Staff'"
      ." AND category != 'Building'"
      ." AND required_level = '0' ORDER BY name";
   $LetterRes = mysql_query($fileQry) or die(mysql_error());

  $template->assign_block_vars('switch_letter',
      array( 'LETTER' => $letter ) );
   $i = 0;//variable to count the categories written on this row
   while($LetterArr = mysql_fetch_array($LetterRes))
   {
       $template->assign_block_vars('letter_row',
          array( 'U_LETTER' => $server_url . '?' . "location=help&item=" .$LetterArr['name']."'>".$LetterArr['name'] ) );
   
   }

} //END LETTER IF

//------------------------------------------------------------------------------------------------//

//if a keyword has been entered show the matching helpfiles
//-----------------------------------------------------------------------------------------------//
if($keyword != '')
{
   //get all of the helpfiles for this keyword
   $KeywordQry = "SELECT distinct name FROM DB1.helpfiles WHERE LOCATE(\"".$keyword."\", name)"
      ." AND category != 'Staff'"
      ." AND category != 'Building'"
      ." AND required_level = '0' ORDER BY name";
   $KeywordRes = mysql_query($KeywordQry) or die(mysql_error());

$template->assign_block_vars('switch_keyword',
      array( 'KEYWORD' => $keyword ) );



   $i = 0;//variable to count the categories written on this row
   while($KeywordArr = mysql_fetch_array($KeywordRes))
   {

       $template->assign_block_vars('keyword_row',
          array( 'U_KEYWORD' => $server_url . '?' . "location=help&item=" .$KeywordArr['name']."'>".$KeywordArr['name'] ) );
   
   }

} //END LETTER IF


//------------------------------------------------------------------------------------------------//

//show the main contents of the helpfiles
//-------------------------------------------------------------------------------------------------//
//get a list of categories to display as links

$catQry = "SELECT distinct category FROM DB1.helpfiles WHERE category != 'Staff'"
   ." AND category != 'Building'"
   ." AND required_level = '0' ORDER BY category";
$catRes = mysql_query($catQry) or die(mysql_error());


$i = 0;//variable to count the categories written on this row
while($catArr = mysql_fetch_array($catRes))
{
   $template->assign_block_vars('category_row',
      array( 'U_CAT_INDEX' => $server_url . '?'
      . "location=help&item=" .$catArr['name']."'>"
      .$catArr['name'] ) );
}

$template->pparse('body');

// standard page footer
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);

?>



The template code
Code: Select all
'<html>
<!-- BEGIN switch_item -->
<h3>{ITEM}</h3>
<table>
<tr>
   <td class="row1">{switch_item.ITEM} </td>
</tr>
  <tr>
   <td class="row1">{switch_item.HELP_ARRAY}</td>
</tr>
</table>
<table>
<tr><td>Related entries:</td><td>
<!-- BEGIN related_link -->
{U_RELATED}
<!-- END related_link -->
</td></tr>
</table>
<!-- END switch_item -->
<br />

<!-- BEGIN switch_category -->
<h3>{CATEGORY}</h3>
<table>
   <tr>
<!-- BEGIN related_link -->
   <td>{U_CATEGORY}</td>
<!-- END related_link -->
</tr>
</table>
<!-- END related_link -->

<h3>Helpfiles beginning with {LETTER}</h3>
<table>
   <tr>
<!-- BEGIN letter_row -->
   <td>{U_LETTER}</td>
<!-- END related_link -->
</tr>
</table>
<!-- END letter_row -->

<h3>Search Results For {KEYWORD}</h3>
<table>
   <tr>
<!-- BEGIN keyword_row -->
   <td>{U_KEYWORD}</td>
<!-- END related_link -->
</tr>
</table>
<!-- END keyword_row -->



<h3>Categorical Index</h3>
<table>
   <tr>
<!-- BEGIN category_row -->
   <td>{U_CAT_INDEX}</td>
<!-- END related_link -->
</tr>
</table>
<!-- END category_row -->
</html>

smsulliva
Registered User
 
Posts: 49
Joined: Mon Aug 02, 2004 6:15 pm

Postby smsulliva » Fri Jan 19, 2007 7:09 pm

I am getting this error: Any help
Code: Select all
Parse error: parse error, unexpected '}' in /home/staff13/public_html/forums/includes/template.php(127) : eval()'d code on line 51



Also, I think the URL's aren't going to work. I thought $server_url was a global variable...
Can someone help me on this?
smsulliva
Registered User
 
Posts: 49
Joined: Mon Aug 02, 2004 6:15 pm


Return to [2.0.x] MOD Requests

Who is online

Users browsing this forum: Amalaswinta and 2 guests