[04/02/07] Rules Page

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in here. No new MODs will be accepted into the MOD Database for phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
Post Reply

Rating:

Excellent!
18
90%
Very Good
1
5%
Good
1
5%
Fair
0
No votes
Poor
0
No votes
 
Total votes: 20

Extensions Robot
Extensions Robot
Extensions Robot
Posts: 27952
Joined: Sat Aug 16, 2003 7:36 am

[04/02/07] Rules Page

Post by Extensions Robot » Sun Aug 06, 2006 12:01 pm

MOD Name: Rules Page
Author: eviL<3
MOD Description: This MOD will add a rules.php page, that works just like faq.php.

MOD Version: 1.0.1 (Updated 02/04/07)
Tested on phpBB Version: 2.0.22

Download File: rules_page_1_0_1.zip
mods overview page: View
File Size: 40896 Bytes

Image

Support for this MOD needs to be asked within this topic. The phpBB Teams are not responsible or required to give anyone support for this MOD. By installing this MOD, the phpBB Support Team or phpBB MODifications Team may not be able to provide support.

This MOD has only been tested by the phpBB MOD Team with the phpBB version listed in the topic. It may not work in any other versions of phpBB.
Last edited by Extensions Robot on Mon Apr 30, 2007 12:30 am, edited 1 time in total.
(this is a non-active account manager for the phpBB Extension Customisations Team)

ycl6
Translator
Posts: 5696
Joined: Sat Feb 15, 2003 10:35 am
Location: Taiwan
Contact:

Post by ycl6 » Sat Aug 26, 2006 12:12 pm

MOD Validated/Released

Notes:
This rule MOD works like the FAQ page you see on the forum header. Admins can add their rules in lang_rules.php.

User avatar
igorw
Former Team Member
Posts: 8024
Joined: Fri Dec 16, 2005 12:23 pm
Location: {postrow.POSTER_FROM}
Name: Igor Wiedler

Post by igorw » Sat Aug 26, 2006 8:34 pm

Whee! Thanks!

Demo:
phpBBModders :: Rules

rules.php
Image

admin/index.php
Image
Last edited by igorw on Sat Sep 23, 2006 8:18 pm, edited 1 time in total.
Igor Wiedler | area51 | GitHub | trashbin | Formerly known as evil less than three

Peter77sx
Registered User
Posts: 3253
Joined: Wed Nov 09, 2005 2:51 pm

Post by Peter77sx » Sun Aug 27, 2006 1:44 am

Nice and easy install. thanks :)


User avatar
RATT
Registered User
Posts: 734
Joined: Fri Aug 19, 2005 6:27 am

Post by RATT » Tue Aug 29, 2006 5:30 am

any chance of getting ya to mod this to where is can be used with this mod evil?

Code: Select all

## MOD Title: faq admin mod
## MOD Author: ZParta < zparta@upnorth.se > (Jens Holmqvist) http://www.upnorth.se 
## MOD Description: This MOD will put the faq in the database and make it editable from the ACP
## MOD Version: 1.4.6 
Like an add-on in the contrib folder?
Love the mod ya made but would be awesome if i could get it as an add-on for the faq-admin aswell.

User avatar
igorw
Former Team Member
Posts: 8024
Joined: Fri Dec 16, 2005 12:23 pm
Location: {postrow.POSTER_FROM}
Name: Igor Wiedler

Post by igorw » Tue Aug 29, 2006 8:22 am

RATT wrote: any chance of getting ya to mod this to where is can be used with this mod evil?

Code: Select all

## MOD Title: faq admin mod
## MOD Author: ZParta < zparta@upnorth.se > (Jens Holmqvist) http://www.upnorth.se 
## MOD Description: This MOD will put the faq in the database and make it editable from the ACP
## MOD Version: 1.4.6 
Like an add-on in the contrib folder?
Love the mod ya made but would be awesome if i could get it as an add-on for the faq-admin aswell.


Well how about you have a look in the contrib folder? :wink: 8)
Igor Wiedler | area51 | GitHub | trashbin | Formerly known as evil less than three

User avatar
RATT
Registered User
Posts: 734
Joined: Fri Aug 19, 2005 6:27 am

Post by RATT » Tue Aug 29, 2006 10:30 am

Yea i did, only one i seen was for faq-editor though.Faq-Admin is configured differently. :|

User avatar
igorw
Former Team Member
Posts: 8024
Joined: Fri Dec 16, 2005 12:23 pm
Location: {postrow.POSTER_FROM}
Name: Igor Wiedler

Post by igorw » Tue Aug 29, 2006 11:04 am

Oh, is it this MOD? If yes, i'll see what i can do :)

EDIT: This is untested:

Code: Select all

# 
#-----[ SQL ]------------------------------------------ 
# 
CREATE TABLE `phpbb_rules` (
  `lang_id` varchar(50) NOT NULL default 'english',
  `faq_id` tinyint(11) NOT NULL default '0',
  `faq_title` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`faq_id`,`lang_id`)
) TYPE=MyISAM;

# 
#-----[ SQL ]------------------------------------------ 
# 
CREATE TABLE `phpbb_rules_text` (
  `lang_id` varchar(50) NOT NULL default 'english',
  `q_id` tinyint(11) NOT NULL default '0',
  `faq_id` tinyint(11) NOT NULL default '0',
  `q` text NOT NULL,
  `a` text NOT NULL,
  PRIMARY KEY  (`q_id`,`lang_id`)
) TYPE=MyISAM;

# 
#-----[ OPEN ]------------------------------------------ 
# 
language/lang_english/lang_admin.php

# 
#-----[ FIND ]------------------------------------------ 
# 
// END-faq_admin_mod

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 
$lang['rules_admin'] = 'Rules Administration';
$lang['Aff_rows_rules'] = 'Affected rows in Rules tables';

# 
#-----[ OPEN ]------------------------------------------ 
# 
includes/constants.php

# 
#-----[ FIND ]------------------------------------------ 
# 
// END-faq_admin_mod

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 
define('RULES_TABLE', $table_prefix.'rules');
define('RULES_TEXT_TABLE', $table_prefix.'rules_text');

# 
#-----[ OPEN ]------------------------------------------ 
# 
rules.php

# 
#-----[ FIND ]------------------------------------------ 
# 
// End session management
//

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
/*

# 
#-----[ FIND ]------------------------------------------ 
# 
?>

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 
*/

// START-faq_admin_mod
//
// Load the appropriate sql-statement
//
$l_title = $lang['Rules'];

if ( $userdata['user_lang'] != "" )
{
	$faq_lang = $userdata['user_lang'];
}
else
{
	$faq_lang = $board_config['default_lang'];
}

//
// Lets build a page ...
//
$page_title = $l_title;
include($phpbb_root_path . 'includes/page_header.'.$phpEx);

$template->set_filenames(array(
	'body' => 'faq_body.tpl')
);
make_jumpbox('viewforum.'.$phpEx, $forum_id);

$template->assign_vars(array(
	'L_FAQ_TITLE' => $l_title, 
	'L_BACK_TO_TOP' => $lang['Back_to_top'])
);

//
// database stuff to faq
//
$sql = "SELECT faq_id, faq_title FROM " . RULES_TABLE . " WHERE lang_id = '" . $faq_lang . "' ORDER BY faq_id";

if ( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not query faq entries', '', __LINE__, __FILE__, $sql);
}
if ($row = $db->sql_fetchrowset($result))
{
	$db->sql_freeresult($result);
}
for($i = 0; $i < count($row); $i++)
{
	$template->assign_block_vars('faq_block', array(
		'BLOCK_TITLE' => $row[$i]["faq_title"])
	);
	$template->assign_block_vars('faq_block_link', array(
		'BLOCK_TITLE' => $row[$i]["faq_title"])
	);
	if ( $lang_sql == 1 )
	{
		$sql = "SELECT * FROM " . BBCODE_TEXT_TABLE . " WHERE lang_id = '" . $faq_lang . "' AND faq_id = " . $row[$i]["faq_id"] . " ORDER BY faq_id,q_id";
	}
	else
	{
		$sql = "SELECT * FROM " . FAQ_TEXT_TABLE . " WHERE lang_id = '" . $faq_lang . "' AND faq_id = " . $row[$i]["faq_id"] . " ORDER BY faq_id,q_id";
	}
	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Could not query faq entries', '', __LINE__, __FILE__, $sql);
	}
	if ($row2 = $db->sql_fetchrowset($result))
	{
		$db->sql_freeresult($result);
	}
	for($j = 0; $j < count($row2); $j++)
	{
		$row_color = ( !($j % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
		$row_class = ( !($j % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
		$template->assign_block_vars('faq_block.faq_row', array(
			'ROW_COLOR' => '#' . $row_color,
			'ROW_CLASS' => $row_class,
			'FAQ_QUESTION' => $row2[$j]["q"],
			'FAQ_ANSWER' => $row2[$j]["a"],

			'U_FAQ_ID' => $row2[$j]["q_id"])
		);
		$template->assign_block_vars('faq_block_link.faq_row_link', array(
			'ROW_COLOR' => '#' . $row_color,
			'ROW_CLASS' => $row_class,
			'FAQ_LINK' => $row2[$j]["q"],

			'U_FAQ_LINK' => '#' . $row2[$j]["q_id"])
		);
	}
}


$template->pparse('body');

include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
// END-faq_admin_mod

# 
#-----[ OPEN ]------------------------------------------ 
# 
admin/admin_faq.php

# 
#-----[ FIND ]------------------------------------------ 
# 
	$module['FAQ_Admin']['BBCode Admin'] = "$file?type=bbcode";

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
	$module['FAQ_Admin']['Rules Admin'] = "$file?type=rules";

# 
#-----[ FIND ]------------------------------------------ 
# 
		case 'bbcode':
			$lang_sql = '1';
			$l_title = $lang['bbcode_admin'];
			$cat_table = BBCODE_TABLE;
			$text_table = BBCODE_TEXT_TABLE;
			$faq_type = 'bbcode';
			break;

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
		case 'rules':
			$lang_sql = '1';
			$l_title = $lang['rules_admin'];
			$cat_table = RULES_TABLE;
			$text_table = RULES_TEXT_TABLE;
			$faq_type = 'rules';
			break;

# 
#-----[ FIND ]------------------------------------------ 
# 

if ( $faq_type == 'bbcode' )
{
	$typelist = "<option value=\"bbcode\">" . $lang['bbcode'] . "</option>\n<option value=\"faq\">" . $lang['FAQ'] . "</option>\n";
}

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
elseif ( $faq_type == 'rules' )
{
	$typelist = "<option value=\"rules\">" . $lang['Rules'] . "</option>\n<option value=\"faq\">" . $lang['FAQ'] . "</option>\n";
}

# 
#-----[ OPEN ]------------------------------------------ 
# 
admin/admin_faq_inst.php

# 
#-----[ FIND ]------------------------------------------ 
# 
		include($phpbb_root_path . 'language/lang_' . $HTTP_POST_VARS['slang'] . '/lang_bbcode.' .$phpEx);
		$inserts_bbcode = insert_faq($faq, BBCODE_TABLE, BBCODE_TEXT_TABLE, $HTTP_POST_VARS['slang']);
		unset($faq);

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
		include($phpbb_root_path . 'language/lang_' . $HTTP_POST_VARS['slang'] . '/lang_rules.' .$phpEx);
		$inserts_bbcode = insert_faq($faq, RULES_TABLE, RULES_TEXT_TABLE, $HTTP_POST_VARS['slang']);
		unset($faq);

# 
#-----[ FIND ]------------------------------------------ 
# 
		$inserts_faq[1] = $db->sql_affectedrows();
		$inserts_bbcode = array(0,0);
		$sql = "DELETE FROM " . BBCODE_TABLE . " WHERE lang_id = '" . $HTTP_POST_VARS['slang'] . "'";
		if( !$q_questions = $db->sql_query($sql) )
		{
			message_die(GENERAL_ERROR, "Couldn't delete category", "", __LINE__, __FILE__, $sql);
		}
		$inserts_bbcode[0] = $db->sql_affectedrows();
		$sql = "DELETE FROM " . BBCODE_TEXT_TABLE . " WHERE lang_id = '" . $HTTP_POST_VARS['slang'] . "'";
		if( !$q_questions = $db->sql_query($sql) )
		{
			message_die(GENERAL_ERROR, "Couldn't delete faq", "", __LINE__, __FILE__, $sql);
		}
		$inserts_bbcode[1] = $db->sql_affectedrows();

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
		$inserts_rules = array(0,0);
		$sql = "DELETE FROM " . RULES_TABLE . " WHERE lang_id = '" . $HTTP_POST_VARS['slang'] . "'";
		if( !$q_questions = $db->sql_query($sql) )
		{
			message_die(GENERAL_ERROR, "Couldn't delete category", "", __LINE__, __FILE__, $sql);
		}
		$inserts_rules[0] = $db->sql_affectedrows();
		$sql = "DELETE FROM " . RULES_TEXT_TABLE . " WHERE lang_id = '" . $HTTP_POST_VARS['slang'] . "'";
		if( !$q_questions = $db->sql_query($sql) )
		{
			message_die(GENERAL_ERROR, "Couldn't delete faq", "", __LINE__, __FILE__, $sql);
		}
		$inserts_rules[1] = $db->sql_affectedrows();

# 
#-----[ FIND ]------------------------------------------ 
# 
		'L_FAQ_CAT' => $inserts_faq[0], 
		'L_FAQ_Q' => $inserts_faq[1], 

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 
		'L_AFFECTED_ROWS_RULES' => $lang['Aff_rows_rules'], 
		'L_RULES_CAT' => $inserts_rules[0], 
		'L_RULES_Q' => $inserts_rules[1], 

# 
#-----[ OPEN ]------------------------------------------ 
# 
templates/subSilver/admin/admin_faq_inst_aff.tpl

# 
#-----[ FIND ]------------------------------------------ 
# 
	<tr>
		<td class="catLeft" colspan="7"><span class="cattitle"><b>{L_AFFECTED_ROWS_BBCODE}</b></span></td>
	</tr>
	<tr> 
		<td class="row2" width="50%"><span class="gen">{L_AFFECTED_ROWS_CAT}</span></td>
		<td class="row1" align="center" valign="middle" width="50%"><span class="gen">{L_BBCODE_CAT}</span></td>
	</tr>
	<tr> 
		<td class="row2" width="50%"><span class="gen">{L_AFFECTED_ROWS_Q}</span></td>
		<td class="row1" align="center" valign="middle" width="50%"><span class="gen">{L_BBCODE_Q}</span></td>
	</tr>
	<tr>
		<td colspan="7" height="1" class="spaceRow"><img src="../templates/subSilver/images/spacer.gif" alt="" width="1" height="1" /></td>
	</tr>

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
	<tr>
		<td class="catLeft" colspan="7"><span class="cattitle"><b>{L_AFFECTED_ROWS_RULES}</b></span></td>
	</tr>
	<tr> 
		<td class="row2" width="50%"><span class="gen">{L_AFFECTED_ROWS_CAT}</span></td>
		<td class="row1" align="center" valign="middle" width="50%"><span class="gen">{L_RULES_CAT}</span></td>
	</tr>
	<tr> 
		<td class="row2" width="50%"><span class="gen">{L_AFFECTED_ROWS_Q}</span></td>
		<td class="row1" align="center" valign="middle" width="50%"><span class="gen">{L_RULES_Q}</span></td>
	</tr>
	<tr>
		<td colspan="7" height="1" class="spaceRow"><img src="../templates/subSilver/images/spacer.gif" alt="" width="1" height="1" /></td>
	</tr>
As already mentioned, i didn't test it, and i highly suggest you to use the other FAQ editor MOD.
Igor Wiedler | area51 | GitHub | trashbin | Formerly known as evil less than three

User avatar
RATT
Registered User
Posts: 734
Joined: Fri Aug 19, 2005 6:27 am

Post by RATT » Tue Aug 29, 2006 4:20 pm

Works great with a couple flaws.Instead of showing the rules that were created in the acp when clicking on rules in the navigation of the header,it brings up the faq even though the page says rules.php.It does show in the acp of being able to be edited however and what was inputted(is that a word? lol) to be shown in rules.php

User avatar
igorw
Former Team Member
Posts: 8024
Joined: Fri Dec 16, 2005 12:23 pm
Location: {postrow.POSTER_FROM}
Name: Igor Wiedler

Post by igorw » Tue Aug 29, 2006 6:37 pm

RATT wrote: Works great with a couple flaws.Instead of showing the rules that were created in the acp when clicking on rules in the navigation of the header,it brings up the faq even though the page says rules.php.It does show in the acp of being able to be edited however and what was inputted(is that a word? lol) to be shown in rules.php


Whoa, i wasn't really expecting it to work that well. Well i'm not gonna put this into a proper addon, because it's just so much edits for a pretty old MOD.
Igor Wiedler | area51 | GitHub | trashbin | Formerly known as evil less than three

User avatar
RATT
Registered User
Posts: 734
Joined: Fri Aug 19, 2005 6:27 am

Post by RATT » Wed Aug 30, 2006 10:55 am

ok , thanks alot for ur time, i'll tinker around with it some more.If i get it working i'll let ya know.

User avatar
ebrahimimami
Registered User
Posts: 32
Joined: Wed May 10, 2006 3:09 pm
Location: Iran - Yazd

Post by ebrahimimami » Sun Sep 03, 2006 8:44 pm

I'm realy interested in this MOD, Specially the structure of rules page

But there's one thing I need and this mod doesn't have.

I want it to be Dynamically Configured in ACP
I mean , an admin be able to
- add categories (such as Posting and PM Abuse ),
- add rules to each category.
- also I need page structure to be same as This Demo

Is there any other MOD (or other version of this mod) that provide my needs ?

User avatar
igorw
Former Team Member
Posts: 8024
Joined: Fri Dec 16, 2005 12:23 pm
Location: {postrow.POSTER_FROM}
Name: Igor Wiedler

Post by igorw » Sun Sep 03, 2006 8:52 pm

I want it to be Dynamically Configured in ACP


Look in the contrib folder, there's an addon for the faq editor MOD

add categories (such as Posting and PM Abuse ),
- add rules to each category.
- also I need page structure to be same as This Demo


This is possible, for a new category, add this to language/lang_english/lang_rules.php:

Code: Select all

$faq[] = array("--","New category");
$faq[] = array("Item title", "Item content.");
Igor Wiedler | area51 | GitHub | trashbin | Formerly known as evil less than three

User avatar
xliz711x
Registered User
Posts: 47
Joined: Sun Jul 02, 2006 7:54 pm
Contact:

Post by xliz711x » Mon Sep 04, 2006 8:51 pm

Hi I installed the mod followed all the instructions but I still can't get the rules to actually show. If I go to the acp they are there but not on the rules page. Any help please?

Post Reply

Return to “[2.0.x] MOD Database Releases”