Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> How To's
Author Message
izone
Involved
Involved



Joined: Sep 07, 2004
Posts: 354
Location: Sweden

PostPosted: Thu Oct 07, 2004 2:39 am Reply with quote

Hi!

I'm trying to make a module and because I'm not so good on php I can make it works. So please help me.

In this module I want to have a frontpage with a little text and a link text at the end of it to another file (file2.php). When user click on this link, I want to file2.php whit a lot of text to open. I've tried on and on but no result.

It's very easy to do this with html but for me difficult to make it works for Nuke.

Please help me.
Best regards
 
View user's profile Send private message
spottedhog
Regular
Regular



Joined: Jun 02, 2004
Posts: 88

PostPosted: Thu Oct 07, 2004 6:58 am Reply with quote

There is an addon called Static HTML, which uses html pages inside a PHP Nuke-like module. If you can easily do what you want with html, then this may be what you need. We have this in our Downloads at [ Only registered users can see links on this board! Get registered or login! ] and it is probably on some other nuke download websites.

The code will display your header, footer, and left blocks along with your html page. You will need to hard code the link if you use original Modules Menu block.

Here is a working example:
[ Only registered users can see links on this board! Get registered or login! ]
 
View user's profile Send private message Visit poster's website
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Thu Oct 07, 2004 7:07 am Reply with quote

You can also just code a standard module and use the include() function to bring in your static html pages.
 
View user's profile Send private message
izone







PostPosted: Fri Oct 08, 2004 3:11 am Reply with quote

Thank you all for anwering.

Raven I don't know how to use that code (I'm really newbie with php).

A friend gave me this code:
Code:


<?php
if (!eregi("modules.php", $PHP_SELF)) {
die ("You can't access this file directly...");
}

$index = 0;   // 0 : do not show right blocks - 1:show right blocks
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));

include("header.php");
if (file_exists("modules/$module_name/copyright.php"))

$ACCEPT_FILE['test1.php'] = 'test1.php';
$ACCEPT_FILE['test2.php'] = 'test2.php';

OpenTable();
echo "<center><img src=\"modules/$module_name/test.gif\" border=\"0\">"; // Your Image
    CloseTable();
OpenTable();

$pagename = $ACCEPT_FILE[$page];

if (!isSet($pagename)) $pagename = "main.php";

include("modules/Test/$pagename");

CloseTable();
include("footer.php");
?>


Which I tested and it works. I want please your opinion on this. The main.php is the first page and from this page I can link to test1.php and test2.php etc.

Becuase this module will have over 400 pages I have to make 400 pages e.g. test1.php ---> test400.php (or page1 to page400.php). Do I have add the code for all of them in this file (this is index.php)? I mean do I have to add this part of code for all 400 pages:

Code:


$ACCEPT_FILE['test1.php'] = 'test1.php';
$ACCEPT_FILE['test2.php'] = 'test2.php';


Best regards
 
spottedhog







PostPosted: Fri Oct 08, 2004 3:23 pm Reply with quote

Here is a slight variation of what Raven described:

Code:
<?

if (!eregi("modules.php", $_SERVER['PHP_SELF'])) {
  die ("You can't access this file directly...");
}
if(!IsSet($mainfile)) { include ("mainfile.php"); }
$index=0;

$go_to_address1="modules/cPanel_Users_Guide/index.html";
$go_to_address=rawurldecode($go_to_address1);
include("header.php");
OpenTable();
echo "<center><h4><a href=\"index.php\">Click to close.</a></h4></center>";
echo "<iframe SRC=\"".$go_to_address."\" width=\"100%\" height=\"1000\"
framespacing=0 frameborder=no border=0 scrolling=auto></iframe>";

CloseTable();
include("footer.php");
die;
?>


It is the index.php page for this module:
[ Only registered users can see links on this board! Get registered or login! ]

I think that module may have more than 400 pages in it.... not sure really.

With this method you will not have to recode anything. Just make sure to have an index.html file and then have all the other pages interlinked.

To use this, change the module name to what you wish, then save the file as an index.php file in a module folder with the same name. Also, put at least the index.html in that folder. Then put all the other html pages within the folder in whatever folder format you have them all linked with.

This method will have you changing only a very few words of code and you will spend much more time uploading the files than anything. And.... you will not have to change a single thing within your 400 html pages. It may take about 1 minute to make all the changes you need to be able to display ALL of your 400 html pages.
 
Lithium
Hangin' Around



Joined: Mar 30, 2004
Posts: 28

PostPosted: Fri Oct 08, 2004 6:38 pm Reply with quote

I just ran across this and that works great for what I need it for. I would like however for me to be able to use &index=1 on the url to make it centered and have the blocks to the right, however, that doesn't work nor can I find how to add that to the above code...

Can anyone help on this?
 
View user's profile Send private message Visit poster's website
Lithium







PostPosted: Fri Oct 08, 2004 6:40 pm Reply with quote

Scratch that, it was staring me right in the face.
 
izone







PostPosted: Sat Oct 09, 2004 4:31 am Reply with quote

Thank you very much Spottedhog!

I'm not able to test it right now but tonight I'll do it. As I see from your page it is great.

Regards
 
izone







PostPosted: Sat Oct 09, 2004 1:44 pm Reply with quote

Wave

spottedhog you are the best.

It works great. Thank you very much.

But I've a question:

How can I use the same background image or colour as the choosen theme, for my htmls?

This is not only for my site and diffrent sites has diffrent theme and ....

I wonder if I could use the choosen theme's css for my htmls.

Do you think it could be possible?

Best regards
 
spottedhog







PostPosted: Sat Oct 09, 2004 7:11 pm Reply with quote

As you can see in the code, it displays the html page in an IFrame. The background would be what is the background of the html page.
 
beetraham
Regular
Regular



Joined: Dec 13, 2003
Posts: 94
Location: Finland (EU)

PostPosted: Sun Oct 10, 2004 11:02 am Reply with quote

izone wrote:


But I've a question:

How can I use the same background image or colour as the choosen theme, for my htmls?

This is not only for my site and diffrent sites has diffrent theme and ....

I wonder if I could use the choosen theme's css for my htmls.

Do you think it could be possible?



Hi izone,

Please find enclosed reference to approach that I've been using for included static HTML pages to reach out the *same appearance* as what is seen with PHP-Nuke:

Let's assume, that initially your static HTML page struct is something similar to this:

Quote:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1458" name=GENERATOR>
</HEAD>
<BODY>
... [body struct continued]... |-->


Now in order to grab out the *very-much-similar-to* form of appearance, make it look like as follows:

Quote:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1458" name=GENERATOR>
<LINK REL="StyleSheet" HREF="http://www.yoursite.com/themes/subBlack3d/style/style.css" TYPE="text/css">
</HEAD>
<BODY>
... [body struct continued]... |-->


Legend : colour code blue == added section

So, basically all you need to do is to add *fixed pointer* to the CSS Style Sheet to be used - just before the closing HEAD tag.

Hope this helps.

BR,

-beetraham

Quote:

[added comment after original post:]

Please note that you should not apply this approach when using the "INCLUDE" approach (i.e. including HTML pages to MODULE structs), as it would most probably be in contradiction to the CSS Style Sheet actively used by PHP-NUKE - i.e. some of the PHP-Nuke CSS declarations would get inevitably overridden by this imaginative INCLUDE associated CSS declaration.

When using with *iFramed* approach (as stated by spottedhog), you can use the approach with a-n-y CSS Style Sheet considered appropriate to meet your targets as iFramed static HTML page is totally independent from PHP-Nuke CSS Style Sheet usage.
 
View user's profile Send private message
izone







PostPosted: Tue Oct 12, 2004 2:25 am Reply with quote

Thank you beetraham

It is what I am looking for almost!!!

Is there a way to write a code like this one you wrote here to use CSS which can tell the docs: U Mr. Html, go and find out which theme is just this user have choosen right now and use the CSS for just thiat theme right now!
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> How To's

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 ©