Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Modules
Author Message
thundarfoot
Regular
Regular


Joined: Jan 16, 2008
Posts: 75

PostPosted: Mon Feb 04, 2008 4:40 pm Reply with quote

I need some help with developing a module/block combo. I dont know what I am doing, and I am a noob...that said here goes.

I have a block that I have made with the wysiwyg editor which contains this code.

Code:
<form onsubmit="this.submit.disabled=\'true\'" action="modules.php?name=My_Module" method="post">

<form id="form1" name="form1" method="post" action="">
  <strong><b>Choose File</strong></b>
  <select name="select">
<option value="http://localhost/raven/modules/My_Module/1.php">File 1</option>
<option value="http://localhost/raven/modules/My_Module/2.php">File 2</option>
  </select>
  <input type="submit" name="submit" value="submit">
</form>


I have a module dir called My_Module inside this folder I have 3 files
index.php (mostly blank)
1.php
2.php (both 1 & 2 are simple query database display scripts that work outside nuke)

the module is active in the admin panel, and it appears like when I click submit the module index.php is loading. not the files I am trying to call.

I have this code at the top of all files.
Code:
if (!defined('MODULE_FILE')) die('You can\'t access this file directly...'); 

require_once('mainfile.php');
require_once('../Connections/LWC.php');
$module_name = basename(dirname(__FILE__));
get_lang($module_name);
$pagetitle = '- You Module Name'; // If you need this to be multi-lingual then you will have to use language defines
include_once 'header.php';
OpenTable();


thank you in advance for any help you can lend
 
View user's profile Send private message
evaders99
Former Moderator in Good Standing


Joined: Apr 30, 2004
Posts: 3221

PostPosted: Mon Feb 04, 2008 4:56 pm Reply with quote

I assume somewhere modules/My_Module/index.php takes whatever the $select variable from the import form and processes that?
I don't understand why you need the full path to it either...
ie
Code:


http://localhost/raven/modules/My_Module/1.php


You could just pass a value (1 or 2) and then index.php needs to include it
Code:


if ($select == 1) include('1.php');
...


Or a better way would just be to use the built-in file parameters of phpNuke
Code:


use

<select name="file">
<option value="1">File 1</option>

and then it should pass the file variable so that it opens correctly in the form
modules.php?name=My_Module&file=1
which opens 1.php

_________________
- Only registered users can see links on this board! Get registered or login! -

Need help? Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website
thundarfoot
PostPosted: Mon Feb 04, 2008 7:37 pm Reply with quote

Actually no my index.php file is blank, I really dont think I need it? I just need to be able to load the files I want based on the choice in the box (a menu like).

using the select name = file instead of submit and changing the value to the file name without the .php extension, seems to be working thank you very much for your example, and your time.
 
evaders99
PostPosted: Tue Feb 05, 2008 12:21 am Reply with quote

Why duplicate what phpNuke does already Smile
Glad you got it working
 
thundarfoot
PostPosted: Tue Feb 05, 2008 2:03 am Reply with quote

I appreciate all the help I have recived and fully plan to choose raven as my host once I have finished building and secured a domain name.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Modules

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©