Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff
Author Message
rebelt
Worker
Worker



Joined: May 07, 2006
Posts: 172

PostPosted: Sun Sep 27, 2009 1:13 am Reply with quote

So when mainfile gives the instruction require_once(./config.php)

The response from the system shouldn't then say No such file or directory (local machine), or a blank page
 
View user's profile Send private message Visit poster's website
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Sun Sep 27, 2009 1:18 pm Reply with quote

I may have to rethink the first part. But, a blank page is almost never a result of a file not found. mainfile.php has a lot of @ before a function. Remove the @ signs and you will eventually see the error(s)
 
View user's profile Send private message
rebelt







PostPosted: Mon Sep 28, 2009 6:21 pm Reply with quote

Quote:
Remove the @ signs and you will eventually see the error(s)

Did that, Only registered users can see links on this board! Get registered or login!. Very Happy
 
spasticdonkey
RavenNuke(tm) Development Team



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

PostPosted: Mon Sep 28, 2009 7:50 pm Reply with quote

what about just making a simple module?

wrap in php tags and save as modules/YOUR_MODULE/index.php
Code:
if (!defined('MODULE_FILE')) die ('You can\'t access this file directly...');

require_once('mainfile.php');
$module_name = basename(dirname(__FILE__));
// To use Custom CSS in your RavenNuke Module
// place CSS file in themes/YOUR_THEME/style directory
// otherwise comment out
define ('RN_MODULE_CSS','your-css.css');
include('header.php');
// show/hide right side blocks true=show false=hide
define('INDEX_FILE', true);

OpenTable();
// will look for html file in modules/YOURMODULE/yourhtmlfile.html
// your html file should only contain only what
// is inbetween the body tags
include('yourhtmlfile.html');
CloseTable();

include('footer.php');


other pages can be added to the module, saving as modules/YOUR_MODULE/whatever.php

and to reach that page:
yoursite.com/modules.php?name=YOUR_MODULE&file=whatever
 
View user's profile Send private message Visit poster's website
rebelt







PostPosted: Tue Sep 29, 2009 2:08 am Reply with quote

I had considered looking into that, but the problem is, a software program creates the files, and it would mean taking out the information between the head tags in 240 files.

The guy who will be updating these files (some of them will be weekly) doesn't have anything other than notepad.

Thanks for the input though.
 
Raven







PostPosted: Tue Sep 29, 2009 9:15 am Reply with quote

Rebelt,

Please send me a private email and describe your process in intricate detail. I'm not sure the process flow is being understood and so we're shooting in the dark, as they say.
 
rebelt







PostPosted: Wed Sep 30, 2009 7:11 am Reply with quote

PM sent
 
rebelt







PostPosted: Thu Oct 01, 2009 2:07 am Reply with quote

After a few pm's with Raven (thanks again), I'm using spasticdonkey's idea.
Created the index.php file
Code:
<?php

if (!defined('MODULE_FILE')) die ('You can\'t access this file directly...');
require_once('mainfile.php');
$module_name = basename(dirname(__FILE__));
// To use Custom CSS in your RavenNuke Module
// place CSS file in themes/YOUR_THEME/style directory
// otherwise comment out
define ('RN_MODULE_CSS','fixtures.css');
include('header.php');
// show/hide right side blocks true=show false=hide
define('INDEX_FILE', true);

OpenTable();
// will look for html file in modules/YOURMODULE/yourhtmlfile.html
// your html file should only contain only what
// is inbetween the body tags
include('index.htm');
CloseTable();

include('footer.php');
?>

http://rebelt.westonpoolleague.org.uk/modules.php?name=Fixtures

That bit works

But when I go to a page I get Sorry, that module file was not found.

In an effort to fix this myself I looked at the nuke howto module, and the index.php has
Code:
$ACCEPT_FILE = array();


$ACCEPT_FILE['whatever.html'] = 'whatever.html';

So I tried adding that (but with the correct filename Wink ), but still get the same error.

Now I'm stuck again.

Sorry if I'm being a bit of a dumb a**e Smile
 
spasticdonkey







PostPosted: Thu Oct 01, 2009 4:53 am Reply with quote

your getting closer, i noticed one url you had formatted almost correctly (you don't need .php on the end):
rebelt.westonpoolleague.org.uk/modules.php?name=Fixtures&file=ws_2009_tables_division_1.php

you get this message because it's not able to find the file
Sorry, that module file was not found.

you should have this file in your module
rebelt.westonpoolleague.org.uk/modules/Fixtures/ws_2009_tables_division_1.php

and if it includes an html file like so:
include('somefile.html');

you should have this file in your module
rebelt.westonpoolleague.org.uk/modules/Fixtures/somefile.html

you can also set
$display_errors = TRUE;
in config.php which may show you some additional error info, just remember to set to false when your done...
 
rebelt







PostPosted: Thu Oct 01, 2009 5:15 am Reply with quote

I only had the one link formated because that was the only file I'd uploaded whilst trying to get it working.

changed the link new error.

Parse error: syntax error, unexpected '<' in /homepages/24/d229158065/htdocs/RebelT/modules/Fixtures/ws_2009_tables_division_1.php on line 2

And line 2 is
<P class=hc2>Division 1 Table</P>

File starts
Code:
<?php

<P class=hc2>Division 1 Table</P>
the other html
?>
 
spasticdonkey







PostPosted: Thu Oct 01, 2009 5:34 am Reply with quote

ya you cant use html inside of php tags like that.
echo '<P class=hc2>Division 1 Table</P>';
would work but really it's easier to format ws_2009_tables_division_1.php like my example above, and if you need to do html have a separate file and include it.
include('somefile.html');
php will escape to html mode and return to php automatically without the need for special formatting. The only reason to write html in php is if you need to use variables or retrieve/post info to/from the db.

btw, although it will look for the html file in:
rebelt.westonpoolleague.org.uk/modules/Fixtures/somefile.html

modules.php loads it as though it were in the root dir
rebelt.westonpoolleague.org.uk/somefile.html

so any image or file paths in the html have to be relative to the root dir, like:
<img src="images/myimage.gif" /> or
<img src="modules/Fixtures/images/myimage.gif" />
 
rebelt







PostPosted: Thu Oct 01, 2009 7:06 am Reply with quote

Grey is the new blonde because I must be missing something.
in index.php I have include('index.htm'); which works fine.
ws_2009_tables_division_1.htm which is definately there but it doesn't find

Shocked

edit.
Changed it back to ws_2009_tables_division_1.php. Finds the file but only displays content.

Trying different things
Added another file ws_2009_tables_division_2.php with the includes for header mainfile etc. Different errors.

I really don't have a scooby and am running out of straws. Very Happy

Both methods described in this topic should work. Shocked Sad Embarassed Mad
 
spasticdonkey







PostPosted: Thu Oct 01, 2009 2:24 pm Reply with quote

if you can archive a couple of the html pages into .zip or .7z, and post or pm a link to download, I'll do you up a simple sample Smile
 
rebelt







PostPosted: Fri Oct 02, 2009 5:34 pm Reply with quote

Would just like to thank Raven and spasticdonkey for their time and help.
Wave
 
Raven







PostPosted: Fri Oct 02, 2009 10:37 pm Reply with quote

So, are you fixed or still searching ?
 
rebelt







PostPosted: Fri Oct 02, 2009 11:34 pm Reply with quote

Once I received the simple sample, I realised I needed a filename.php for every filename.html.

I have to create a load of files now but it should only need doing once.

I must admit though, I'm curious as to why the ../mainfile.php route didn't work
 
Raven







PostPosted: Sat Oct 03, 2009 12:10 am Reply with quote

My intuition tells me it's still an issue of relative directory access. When I get stumped like this I start using absolute paths everywhere. For instance, you set a constant like define('BASEPATH','/home/userid/public_html/somepath/'); where somepath is where mainfile.php resides. then everything is relative to BASEPATH.

Instead of guessing like include '../../mainfile.php'; it now becomes include BASEPATH . 'mainfile.php'; or include BASEPATH . 'config.php';
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff

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 ©