Add a new page to EQdkp

From IT Wiki
Jump to navigation Jump to search

Introduction: This guide will show you how to create a new page in EQdkp. Useful if you want rules, applications, etc., and use EQdkp as the main portal for your guild's site.


Scenario: You want to make a new rules page stating the rules of your DKP system.


Step 1

Create rules.php in root of EQdkp installation, where viewmember.php and others are.

 <?php
 /******************************
 * EQdkp
 * Copyright 2002-2003
 * Licensed under the GNU GPL.  See COPYING for full terms.
 * ------------------
 * rules.php
 * Began: Wed October 12 2005
 *
 * $Id: rules.php,v 1.3 2005/10/12 21:09:08 Dyfrin Exp $
 *
 ******************************/

 define('EQDKP_INC', true);
 $eqdkp_root_path = './';
 include_once($eqdkp_root_path . 'common.php');

 $eqdkp->set_vars(array(
    'page_title'    => sprintf($user->lang['title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']),
    'template_file' => 'rules.html',
    'display'       => true)
 );
 ?>

Step 2

Make rules.html in the templates/default/ folder

 <!-- INCLUDE page_header.html -->
 <table width="100%" border="0" cellspacing="1" cellpadding="2">
 <tr><th colspan="5" align="left">DKP Rules</th>
 <tr>
 Here are some rules for the DKP system
 blah blah
 and more blah
 and bards get all loot
 </table>
 <!-- INCLUDE page_tail.html -->

Step 3

Link to the page in the includes/eqdkp.php under menu1

 array('link' => 'rules.php' . $SID, 'text' =>  $user->lang['menu_rules'],     'check' => '')
  • Make sure there is a comma , after all arrays except for the last one.

Step 4

Create the language entry for menu_rules in language/xxxxx/lang_main.php

 $lang['menu_rules'] = 'Rules';

Step 5

You must decide on authorization. If you wish people who are not logged in to see the new page, you are done.

Restrict access

To modify it to only allow users who are allowed to list members (a good general security setting for non admin) to view the link and page, modify the following steps:

Step 1

Add this after include_once

 $user->check_auth('u_member_list');

Step 3

Change

 'check' => ''

to

 'check' => 'u_member_list'

Step 4

Change denied reason

 $lang['noauth_u_member_view'] = 'You do not have permission to view this page.';

Questions

Q1

I put in all the code, but when I load my page up I get the following error:

Parse error: syntax error, unexpected ';', expecting ')' in /home/.odelia/dblack941/www.numinouswow.com/eqdkp/includes/eqdkp.php on line 343

Here is my code for Menu 1:

 //
 // Menu 1
 //
 $main_menu1 = array(
    array('link' => 'viewnews.php' . $SID, 'text' =>   $user->lang['menu_news'], 'check' => ''),
    array('link' => 'listmembers.php' . $SID, 'text' =>  $user->lang['menu_standings'], 'check' => 'u_member_list'),
    array('link' => 'listraids.php' . $SID, 'text' =>  $user->lang['menu_raids'],     'check' => 'u_raid_list'),
    array('link' => 'listevents.php' . $SID, 'text' => $user->lang['menu_events'],    'check' => 'u_event_list'),
    array('link' => 'listitems.php' . $SID, 'text' => $user->lang['menu_itemval'],   'check' => 'u_item_list'),
    array('link' => 'listitems.php' . $SID . '&' . URI_PAGE . '=history', 'text' => $user->lang['menu_itemhist'], 'check' => 'u_item_list'),
    array('link' => 'summary.php' . $SID, 'text' => $user->lang['menu_summary'],   'check' => 'u_raid_list'),
    array('link' => 'stats.php' . $SID, 'text' => $user->lang['menu_stats'],     'check' => 'u_member_list'),
    array('link' => 'rules.php' . $SID, 'text' => $user->lang['menu_rules'],
                );

Answer

You missed the

 'check' => '')

part in the last line, when you copied Step 3...

Q2

Looks good to me, I will try it later today as i need to add a link to the rules, one question, if i want to add a link on the nav menu to a page outside of the root of EQdkp or to another web site what should the code be?

Q3

I have done everything just like stated above. When I look at my rules page I am not getting the "DKP RULES" at the top of the page, it is showing underneath the page tail for some reason.

Any ideas?

I have tried this on both my default template and my alternate template and it is doing the same thing.


Answer

make sure your rules.html is in any template folder that you use.

Q4

Yup I did that. (IMG:http://forums.eqdkp.com/style_emoticons/default/smile.gif)

Seems strange because I have been checking the viewnews.html and it looks to be in the same format.

From what I know it should be working.

I'll keep trying some other things.

Thanks.

Answer

QUOTE I have done everything just like stated above. When I look at my rules page I am not getting the "DKP RULES" at the top of the page, it is showing underneath the page tail for some reason.


I am getting the same thing here.

The Crimon Dawn, DKP Rules

Thank you for your work though, once I get it to work this will be very nice.

-Avar

--Edit after doing a massive amount of tabling I got it. the first part of my code is attached. Follow the link to see if you like it. You also need to end the table prior to having the tail statement.

 </table>
 <!-- INCLUDE page_tail.html -->
 <!-- INCLUDE page_header.html -->
 <table width="100%" border="0" cellspacing="1" cellpadding="2">
 <tr><th colspan="5" align="left">DKP Rules of The Crimson Dawn</th></tr>
 </table>

 &nbsp <p>
 <table width="100%" border="0" cellspacing="1" cellpadding="2">
 <!--<td><th colspan="5" align="left">Examples</th></td>-->
 <tr><th colspan="5" align="left">On time DKP:</th>
 <tr><td>If you are on time you gain +1 DKP, if the whole group is on time you gain a bonus +2 DKP  for a total of +3 DKP.</td>
 </table>
 &nbsp <p>
 <table width="100%" border="0" cellspacing="1" cellpadding="2">
 <tr><th colspan="5" align="left">Per hour DKP:</th>
 <tr><td>You will gain +1 DKP per hour in the instance. This will be awarded at the time of a boss   kill.
 <td><u>Example:</u><br>
 -It takes 1 hour to get to Venoxis, you gain +1 DKP.<br>
 -Another hour to Jeklik, you gain +1 DKP.</td>
 </table>

Q5

I have this php file with a whole bunch of includes etc, which pulls item prices from a table in the database. All i want to do is add the header and footer to it. I have tried what is mentioned above, but i think because my itemlist page is a php file, when i try make the html template and copy the code into their, it doesn't read everything correctly. I would really appreciate it if someone told me exactly what i need to do in order to get this working. I can make a blank html page with the header and footer, exactly as explained as above in this topic, but for the life of me i cannot get this file i link below to have a header and footer added to it.

http://damagetrain.com/eqdkp/itemlist.php

Thanks in advance if anyone is able to solve this problem for me.

Q5a

Can you pot the code in your HTML file please.

In order to have the header and footer, which I am sure you know, must be in the file. I can not see that as the are comments. Please copy the begin chunk and bottome chunk of code.

Thanks, Avar

Q5b

QUOTE(Avar @ Aug 17 2006, 02:43 PM) [snapback]34190[/snapback] Can you pot the code in your HTML file please.

In order to have the header and footer, which I am sure you know, must be in the file. I can not see that as the are comments. Please copy the begin chunk and bottome chunk of code.

Thanks, Avar


I'm not quite sure what you are asking. That php file is the only file I have which displays that Item Prices page. I'm aware i need to Include the page_header.html and page_tails.html, but it doesn't seem as easy as a simple include statement. If you want the entire code of that PHP file it is as follows:

 <?
 include 'includes/db.php';
 include 'includes/classes.php';
 include 'includes/wowclass.php';
 ?>

 <html>
 <head>
 <title><?=$rad['value']?> - DKP</title>
 <link rel="stylesheet" href="includes/style.css">
 <script language="javascript1.2" src="js/fn_klocka.js"></script>
 </head>
 </html>
 <table border="0" cellspacing="0" cellpadding="0" width="100%" class="block">
 <tr>
    <td width="100%" align="center" class="titlebg">Item Values</td>
 </tr>
 <tr>
    <td valign="top" width="100%" align="center">

    <table border="0" cellspacing="0" cellpadding="5">
    <tr>
        <td valign="top">
        <table cellspacing="0" cellpadding="0">
        <tr>
        <td width="80"><a href="itemlist.php?sort=slot">Slot</a></td>
            <td width="300"><a href="itemlist.php?sort=name">Item</a></td>
            <td width="50"><a href="itemlist.php?sort=ilvl">ilvl</a></td>
            <td width="50"><a href="itemlist.php?sort=smod">smod</a></td>
            <td width="50"><a href="itemlist.php?sort=zmod">zmod</a></td>
            <td width="50"><a href="itemlist.php?sort=value">Value</a></td>
        </tr>
        <?
        $sort = $_GET['sort'];

        if($sort == "value" || $sort== "ilvl"){
                $query = "item.$sort DESC";
        } elseif($sort == "item") {
        $query = "item.$sort ASC";
        } elseif($sort == "slot") {
        $query = "item.$sort ASC";
        } elseif($sort == "smod") {
        $query = "item.$sort ASC";
        } elseif($sort == "zmod") {
        $query = "item.$sort ASC";
        } else {
        $query = "item.name ASC";
        }
        $result = new Mysql;
        foreach($result->new_array("
        item.id as iid,
        item.name As item,
        item.ilvl,
        item.smod,
        item.zmod,
        item.value,
        item.slot",
        "item",
        "ORDER BY $query") as $rad){
        ?>
              <tr onmouseout="style.backgroundColor='#000000';" onmouseover= "style.backgroundColor='#2A2A30';">
            <td width="150"><FONT COLOR="#FFFFFF"><?=$rad['slot']?></td>
                    <td><FONT COLOR="#FF0000"><?=stripslashes($rad['item'])?></a></td>
            <td><?=$rad['ilvl']?></td>
            <td><?=$rad['smod']?></td>
            <td><?=$rad['zmod']?></td>
                    <td><FONT COLOR="#FFFFFF"><?=$rad['value']?></td>
                </tr>
        <?}?>
        </table>
        </td>
    </tr>
    </table>

    </td>
 </tr>
 </table>
    </td>
 </tr>

Answer

 <?
 include 'includes/db.php';
 include 'includes/classes.php';
 include 'includes/wowclass.php';
 ?>

 <html>
 <head>
 <title><?=$rad['value']?> - DKP</title>
 <link rel="stylesheet" href="includes/style.css">
 <script language="javascript1.2" src="js/fn_klocka.js"></script>
 </head>
 </html>
 <!-- INCLUDE page_header.html -->
 <table border="0" cellspacing="0" cellpadding="0" width="100%" class="block">
 <tr>
    <td width="100%" align="center" class="titlebg">Item Values</td>
 </tr>
 <tr>

You need to add:

 <!-- INCLUDE page_header.html -->

where I put it. That will give you a header.

Q6

Did absolutely nothing when i added that. I even tried:

 <!-- INCLUDE ./eqdkp/templates/default/page_header.html -->

Just in case there was a path problem, which there wasn't. I think there is more too it than this. Like I said i can Create a blank page with a header like explained above. Problem is my file is a .php file

Q7

I have been trying forever on a million different ways to get my forum embedded into the eqdkp.

I do not simply wish to add a link, I want to keep the template intact and instead of where the news, the dkp, the progress etc etc appears, I want the forum to appear.

So I don't want to put something between {main menu 1} and {main menu 2} - I went into the code and adjusted the source of those tags in eqdkp.php

The first line shows the addition of the forum button.

 //
 // Menu 1
 //
   $main_menu1 = array(
        array('link' => 'forum.php' . $SID, 'text' =>  $user->lang['menu_forum'],      'check' => ''),
        array('link' => 'viewnews.php' . $SID, 'text' =>  $user->lang['menu_news'],      'check' => ''),
        array('link' => 'listmembers.php' . $SID, 'text' => $user->lang['menu_standings'], 'check' => 'u_member_list'),
        array('link' => 'listraids.php' . $SID, 'text' => $user->lang['menu_raids'],     'check' => 'u_raid_list'),
        array('link' => 'listevents.php' . $SID, 'text' => $user->lang['menu_events'],    'check' => 'u_event_list'),
        array('link' => 'listitems.php' . $SID, 'text' => $user->lang['menu_itemval'],   'check' => 'u_item_list'),
        array('link' => 'listitems.php' . $SID . '&amp;' . URI_PAGE . '=history', 'text' => $user->lang['menu_itemhist'],  'check' => 'u_item_list'),
        array('link' => 'summary.php' . $SID, 'text' => $user->lang['menu_summary'],   'check' => 'u_raid_list'),
        array('link' => 'stats.php' . $SID, 'text' => $user->lang['menu_stats'],     'check' => 'u_member_list')

Then I went to the language file and added the following, only copied till you could see the forum code, obviously that wasn't the end of the list:

 // Titles
 $lang['admin_title_prefix']   = "%1\$s %2\$s Admin";
 $lang['listadj_title']        = 'Group Adjustment Listing';
 $lang['listevents_title']     = 'Event Values';
 $lang['listiadj_title']       = 'Individual Adjustment Listing';
 $lang['listitems_title']      = 'Item Values';
 $lang['listnews_title']       = 'News Entries';
 $lang['listmembers_title']    = 'Member Standings';
 $lang['listpurchased_title']  = 'Item History';
 $lang['listraids_title']      = 'Raids Listing';
 $lang['listforum_title']      = 'Forum';

and

 // Main Menu
 $lang['menu_admin_panel'] = 'Administration Panel';
 $lang['menu_events'] = 'Events';
 $lang['menu_itemhist'] = 'Item History';
 $lang['menu_itemval'] = 'Item Values';
 $lang['menu_news'] = 'News';
 $lang['menu_raids'] = 'Raids';
 $lang['menu_register'] = 'Register';
 $lang['menu_settings'] = 'Settings';
 $lang['menu_standings'] = 'Standings';
 $lang['menu_stats'] = 'Stats';
 $lang['menu_summary'] = 'Summary';
 $lang['menu_forum'] = 'Forum';

I then made a file as instructed called forum.php

 <?php
 /******************************
 * EQdkp
 * Copyright 2002-2003
 * Licensed under the GNU GPL.  See COPYING for full terms.
 * ------------------
 * forum.php
 * Began: Wed October 12 2005
 *
 * $Id: forum.php,v 1.3 2005/10/12 21:09:08 Dyfrin Exp $
 *
 ******************************/

 define('EQDKP_INC', true);
 $eqdkp_root_path = './';
 include_once($eqdkp_root_path . 'common.php');


 $eqdkp->set_vars(array(
    'page_title'    => sprintf($user->lang['title_prefix'], $eqdkp->config['guildtag'], $eqdkp->config['dkp_name']),
    'template_file' => 'forumtest/index.php',
    'display'       => true)
 );
 ?>

The following error occurs:

Fatal error: Template->loadfile(): Error - file body does not exist or is empty in /home/shadow00/domains/shadowbladeclan.com/public_html/mcdkp/includes/class_template.php on line 205

Another option I have tried is, using the HTML file to link it through:

 <?php
 /******************************
 * EQdkp
 * Copyright 2002-2003
 * Licensed under the GNU GPL.  See COPYING for full terms.
 * ------------------
 * forum.php
 * Began: Wed October 12 2005
 *
 * $Id: forum.php,v 1.3 2005/10/12 21:09:08 Dyfrin Exp $
 *
 ******************************/

 define('EQDKP_INC', true);
 $eqdkp_root_path = './';
 include_once($eqdkp_root_path . 'common.php');


 $eqdkp->set_vars(array(
    'page_title'    => sprintf($user->lang['title_prefix'], $eqdkp->config['guildtag'],   $eqdkp->config['dkp_name']),
    'template_file' => 'forum.html',
    'display'       => true)
 );
 ?>

The code in the html file:

 <!-- INCLUDE page_header.html -->
 <!-- INCLUDE forumtest/index.php-->
 <!-- INCLUDE page_tail.html -->

I have tried Iframes, tables etc.,etc...nothing works.