Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Converting/Creating Modules
Author Message
captdave
New Member
New Member



Joined: Dec 04, 2008
Posts: 3

PostPosted: Thu Dec 04, 2008 9:57 pm Reply with quote

I hope i posted this in the right spot. I have been away from all nuke flavors for a while. Now all of a sudden I find myself hooked again after playing with v2.30.

I need to create a module that will display my html content. There will be several pages in the module, so I need to be able to call each page. Doing this in an iframe is something i really want to avoid. I also more than likely will end up with a few of these modules.

About 100 years ago i got this code from chatserv. I think i was using v7ish of php-nuke. Is there an easy fix to get this to work with raven nuke 2.30?

Code:


<?PHP

if(!IsSet($mainfile)) { include ("mainfile.php"); }
$index = 1;
automated_news();

function theindex() {
global $storyhome, $httpref, $httprefmax, $topicname, $topicimage, $topictext, $datetime, $user, $cookie, $nukeurl;
include("header.php");
if (isset($cookie[3])) {
  $storynum = $cookie[3];
} else {
  $storynum = $storyhome;
}
?>


XXXXXXXXXXXXXXXXXXXXX
ADD HTML CONTENT HERE
XXXXXXXXXXXXXXXXXXXXX


<?PHP
 include("footer.php");
}

switch ($op) {
  default:
    theindex();

}
?>


Thanks for any help
 
View user's profile Send private message
jakec
Site Admin



Joined: Feb 06, 2006
Posts: 3048
Location: United Kingdom

PostPosted: Fri Dec 05, 2008 1:31 am Reply with quote

What I would do is have a look at one of the standard modules that comes with RN, or if you do a search here for blank module you should find some helpful posts.
 
View user's profile Send private message
captdave







PostPosted: Fri Dec 05, 2008 2:01 am Reply with quote

i did try several times to get the legal module to work for what i need but I just managed to massacre my install. I did look for a blank module and i also just looked again. no luck or maybe i am just searching wrong. if you know of one i would be forever in your debt if you can point me in the right direction. I have been working on this for over a week now. i have been able to make all of the modifications i needed but this one.
 
jakec







PostPosted: Fri Dec 05, 2008 3:24 am Reply with quote

Do a search for "blank and module".

Have you also looked at using the Content module?
 
fkelly
Former Moderator in Good Standing



Joined: Aug 30, 2005
Posts: 3312
Location: near Albany NY

PostPosted: Fri Dec 05, 2008 7:36 am Reply with quote

I once created a donothing module for testing. Here's the code.

Code:
<?php


if ( !defined('MODULE_FILE') )
{
   die("You can't access this file directly...");
}

require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
get_lang($module_name);

include_once('header.php');
echo 'do nothing module . <br .>';


include_once('footer.php');

?>



You might be able to use that to get started.
 
View user's profile Send private message Visit poster's website
captdave







PostPosted: Fri Dec 05, 2008 10:07 pm Reply with quote

fkelly

You are the man, that is exactly what i am looking for. i changed it just a little to allow regular html to be edited easy in dreamweaver.

Code:


<?php

if ( !defined('MODULE_FILE') )
{
   die("You can't access this file directly...");
}

require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
get_lang($module_name);

include_once('header.php');
?>
HTML GOES HERE

<?php
include_once('footer.php');

?>
 
spasticdonkey
RavenNuke(tm) Development Team



Joined: Dec 02, 2006
Posts: 1693
Location: Texas, USA

PostPosted: Mon Dec 08, 2008 8:45 am Reply with quote

I would probably just create a separate html file and put it in your module rather than hop in and out of php like that...

Code:
include("yourpage.html"); 


write the page in xhtml and remove the head, body, and html tags as they will be loaded by RN
basically just use what is in-between the body tags in your html page
 
View user's profile Send private message Visit poster's website
fkelly







PostPosted: Mon Dec 08, 2008 9:20 am Reply with quote

I'd be inclined to agree with spasticdonkey about jumping in and out of PHP. There is a lot of code in *nuke that does that (ending php, starting html, starting php, ending it, etc. Personally I've come not to "like" that. I convert most things I'm working on to just echoing the html ... that way you can access variables and constants more easily and it's just clearer what you are doing. But including the html file will work too. Use single quotes though: include('yourpage.html') and you will save a billionth of a nanosecond and be more generally compliant with the approach we have taken in RN.
 
montego
Site Admin



Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Mon Dec 08, 2008 5:29 pm Reply with quote

another option would be:

echo <<< _HTML_

put all your html here (what should be between the body tags)

_HTML_;

This way, if you needed to embed some variables and have them resolve to their values, it would do it for you. But, yes, it is the slower of the options in terms of processing time, but doubtful that will be of concern.

_________________
Where Do YOU Stand?
HTML Newsletter::ShortLinks::Mailer::Downloads and more... 
View user's profile Send private message Visit poster's website
spasticdonkey







PostPosted: Mon Dec 08, 2008 6:15 pm Reply with quote

fkelly wrote:
Use single quotes though: include('yourpage.html') and you will save a billionth of a nanosecond and be more generally compliant with the approach we have taken in RN.


I thought some of my pages seemed a billionth of a nanosecond slow Shocked Laughing

I've been working on a site for several months, with many custom modules, and have to say I didn't adhere to using single quotes.... am i asking for trouble in future RN versions?
 
Dawg
RavenNuke(tm) Development Team



Joined: Nov 07, 2003
Posts: 928

PostPosted: Mon Dec 08, 2008 6:55 pm Reply with quote

spasticdonkey wrote:
and have to say I didn't adhere to using single quotes.... am i asking for trouble in future RN versions?


Man....Dude....Your Screwed!

Dawg
Shocked Cool Laughing












This was said to be funny....
 
View user's profile Send private message
fkelly







PostPosted: Mon Dec 08, 2008 8:07 pm Reply with quote

The use of single quotes is not mandatory. PHP will work either way. The RN team has tried to convert as much code from double quotes to single quotes as possible over the course of the last few releases but there is still a ton of "legacy" code using double quotes. This is not something to worry about, not now nor as far as I can project in the future. It is just something where if you are writing new code or going in to modify older code you can make a small difference in efficiency by using single quotes.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Converting/Creating 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 ©