Author |
Message |
Bigboy177
Worker


Joined: Jul 07, 2004
Posts: 192
|
Posted:
Wed Jul 21, 2004 2:38 pm |
|
I want to make my own module... A module which will only display one page of data... How should I start such module... Can someone give me some advice how to make a module... |
|
|
|
 |
sixonetonoffun
Spouse Contemplates Divorce

Joined: Jan 02, 2003
Posts: 2496
|
Posted:
Wed Jul 21, 2004 2:58 pm |
|
Just a rough start here
modules/Your_Module_Name/index.php
<?php
if (!eregi("modules.php", $_SERVER['SCRIPT_NAME'])) {
die ("You can't access this file directly...");
}
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
include("header.php");
$index = 0;
OpenTable();
Your content here
CloseTable();
include("footer.php");
?> |
_________________ [b][size=5]openSUSE 11.4-x86 | Linux 2.6.37.1-1.2desktop i686 | KDE: 4.6.41>=4.7 | XFCE 4.8 | AMD Athlon(tm) XP 3000+ | MSI K7N2 Delta-L | 3GB Black Diamond DDR
| GeForce 6200@433Mhz 512MB | Xorg 1.9.3 | NVIDIA 270.30[/size:2b8 |
|
|
 |
Bigboy177

|
Posted:
Wed Jul 21, 2004 6:07 pm |
|
Thanks for your help...
I've got another quetions... I'm trying to read the current Date... How can I do it...
I wrote something like this:
Code:
OpenTable();
echo "<center><font class=\"option\">Harmonogram Premier</font></center><br><br>"
."<table width=\"100%\" cellpadding=\"4\" cellspacing=\"0\" border=\"0\">"
."<tr><td bgcolor=\"$bgcolor2\">Styczeń</td></tr><tr><td>";
$today = getdate();
$eday = $today[mday];
$emonth = $today[mon];
$result = $db->sql_query("SELECT yid, mid, did, content FROM ".$prefix."_ephem WHERE mid='$emonth' $querylang");
while ($row = $db->sql_fetchrow($result)) {
$yid = intval($row['yid']);
$mid = intval($row['mid']);
$did = intval($row['did']);
$econtent = stripslashes($row['content']);
echo"<strong><big>·</big></strong>$yid.$mid.$did<br>";
echo"<strong><big>·</big></strong>$econtent<br>";
}
echo "</td></tr></table>";
CloseTable();
include("footer.php");
|
But it doesn't work... When I set manualy to read mid='6' it works but I want to read data from the current month it doesn't work...
And aslo the second question...
this is current day $eday = $today[mday];
this is current month $emonth = $today[mon];
but how can I read current year...
maybe like this : $eyear = $today[year];
Please help... |
|
|
|
 |
sixonetonoffun

|
Posted:
Thu Jul 22, 2004 3:04 am |
|
Looks good just add $db to your missing Globals line and yes $eyear = $today[year]; should work fine in the getdate() |
|
|
|
 |
Bigboy177

|
Posted:
Thu Jul 22, 2004 12:54 pm |
|
Thanks a lot for your help... It's working like a charm... I'll probrably have more questions... But now it's all ok... Thanks Again...  |
|
|
|
 |
Bigboy177

|
Posted:
Thu Jul 22, 2004 3:25 pm |
|
I have written my Module... I thinks I'm done... Now I've got a question... I want my module to open from a link in a Main Page... But I don't want it to open on the whole page just as popup window. And I would like to set size of that Popup window...
How can I do it... ?? Can you help @sixonetonoffun...  |
|
|
|
 |
Bigboy177

|
Posted:
Fri Jul 23, 2004 5:07 am |
|
Is it even possible to have open a Module in a popup... ?? |
|
|
|
 |
Bigboy177

|
Posted:
Fri Jul 23, 2004 6:35 pm |
|
I would like to have pages opened by links in my modeule how can I do it without writing a new file... I want for example...
I enter my module... And I see...
Todays Events...
1. Bla bla bla
2. Working
3. Playing
Than Under that events I see links:
[Tomorrows Events] [Yesterdays Events]
And I want to this links to open a new page... but I don't want to write a second and third new file... Can I use some goto function or something like that... Please help... |
|
|
|
 |
sixonetonoffun

|
Posted:
Fri Jul 23, 2004 10:34 pm |
|
You can make each page in the same file look at the simpler modules lije Encyclopedia as an example to work from. Its pretty simple to follow. |
|
|
|
 |
Bigboy177

|
Posted:
Sat Jul 24, 2004 4:29 am |
|
I've figured it out... After posting... Thanks for help... My module is getting better and better... And I understand PHP more and more...  |
|
|
|
 |
brentnhunter
Client

Joined: Sep 10, 2004
Posts: 166
|
Posted:
Sun Oct 17, 2004 12:51 pm |
|
It looks like the original script in the beginning of this message thread shows how to create a module that can't be called directly. What about a module that can be called directly? I would like to create an About This Site module, so when pople click on the module link, it shows them a page of information, possibly with links to follow-on pages.
And how do I create the follow-on pages?
Thanks for any help anyone can provide!
Brent Hunter
http://www.EarthCommCenter.com |
|
|
|
 |
ecvej
Hangin' Around

Joined: Oct 10, 2004
Posts: 45
Location: Northampton, UK
|
Posted:
Mon Oct 18, 2004 11:48 am |
|
brentnhunter the code above CAN be called directly from your module block or whereever. Name it index.php and put it in a folder called About_This_Site in your modules folder. Then edit the index.php page, putting the links in it as I showed you in the other thread to your follow on pages.
To make the follow on pages, use them same base code as above and save it in the same module folder. eg save it as index2.php
The code below, inserted into your index page will make a link to index2.php
Code:echo "<a href="modules.php?name=About_This_Site%20&%20file=index.php2">Page 2</a>";
|
Get it? |
Last edited by ecvej on Wed Oct 20, 2004 12:03 am; edited 1 time in total |
|
|
 |
brentnhunter

|
Posted:
Tue Oct 19, 2004 11:35 pm |
|
Yes, I previously figured it out but thank you very much for your reply!
Brent |
|
|
|
 |
|