New custom pages.

Discussion forum for MOD Writers regarding MOD Development.
AussieFishKeeping
Registered User
Posts: 60
Joined: Tue Apr 12, 2011 6:47 am

New custom pages.

Post by AussieFishKeeping »

Hey,
I was just wondering how to move the custom pages around in my file directory. This is hard to explain so I'm going to try my best to say it :)
Ok so I need to make a lot of pages and I would like to keep them organized in a folder.

I want the php file to look like this,

name of folder/file.php

Instead of,

file.php

I don't really know if you can make folders for the body.html files but I would like it to look like this,

styles/name of style/template/name of folder/file_body.html

Instead of,

style/name of style/template/file_body.html


I hope someone can understand what I'm trying to explain.
Thank you.

Pit$Bull
Former Team Member
Posts: 23099
Joined: Sat Dec 02, 2006 4:08 pm
Name: Can't Remember

Re: New custom pages.

Post by Pit$Bull »

As long as the paths are setup correctly it should be no problem, no we can't help you with that.

AussieFishKeeping
Registered User
Posts: 60
Joined: Tue Apr 12, 2011 6:47 am

Re: New custom pages.

Post by AussieFishKeeping »

Pit$Bull wrote:As long as the paths are setup correctly it should be no problem, no we can't help you with that.
Thanks for your reply, where can I get help with that?

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51933
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: New custom pages.

Post by Brf »

Why do you need help? What is preventing you from putting your files in other folders?

AussieFishKeeping
Registered User
Posts: 60
Joined: Tue Apr 12, 2011 6:47 am

Re: New custom pages.

Post by AussieFishKeeping »

Brf wrote:Why do you need help? What is preventing you from putting your files in other folders?
I just don't know what edits to make (I'm not really an expert at phpbb) I tried moving the php file but it didn't work.

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51933
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: New custom pages.

Post by Brf »

Your root_path needs to be the relative path to your phpbb's root folder.

User avatar
Lumpy Burgertushie
Registered User
Posts: 67243
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: New custom pages.

Post by Lumpy Burgertushie »

the root path he is talking about is the one in the new custom php file you created.

also, in that file , you will have to put the path to the html file correct.

then, when you create the link to the new file, you will have to create the correct path in the link.

personally, I think this is all too much trouble . why not use the stystem as it is already designed.

put all the new php files in the root with the index.php

put all the html files in the template folder with the rest of the html files.


done.
no confusion

robertt
I'm baaaaaccckkkk. still doing work on donation basis. PM your needs.

Premium phpBB 3.3 Styles by PlanetStyles.net

If nobody is in the forest, does a tree really fall?

AussieFishKeeping
Registered User
Posts: 60
Joined: Tue Apr 12, 2011 6:47 am

Re: New custom pages.

Post by AussieFishKeeping »

Lumpy Burgertushie wrote: why not use the stystem as it is already designed.
Because I intend to make over 300 of them and need them to be organized.

manic2
Registered User
Posts: 435
Joined: Thu Jun 12, 2008 9:16 pm

Re: New custom pages.

Post by manic2 »

I've always used this at the bottom of my php files:-
$template->set_filenames(array(
'body' => 'name_of_folder/name_of_file.html',
));
This points to (say for prosilver):-
\styles\prosilver\template\name_of_folder\name_of_file.html

(my php files are in the root)
manic

AussieFishKeeping
Registered User
Posts: 60
Joined: Tue Apr 12, 2011 6:47 am

Moving .php files into folders?

Post by AussieFishKeeping »

Hello.
Im just wondering if its possible to move .php file into folders?
Im trying to setup a new custom page but want the .php file in its own folder so i can keep them organized.
I tried moving it then pointing the browser to the file but i got this error,
Warning: include(./common.php) [function.include]: failed to open stream: No such file or directory in /home/afk/public_html/profiles/aboutus.php on line 5

Warning: include(./common.php) [function.include]: failed to open stream: No such file or directory in /home/afk/public_html/profiles/aboutus.php on line 5

Warning: include() [function.include]: Failed opening './common.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/afk/public_html/profiles/aboutus.php on line 5

Fatal error: Call to a member function session_begin() on a non-object in /home/afk/public_html/profiles/aboutus.php on line 8
My .php file looks like this,

Code: Select all

<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();

page_header('About Us');

$template->set_filenames(array(
    'body' => 'fish_profiles/aboutus_body.html',
));

make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"));
page_footer();
?>
And my body.html looks like this.

Code: Select all

<!-- INCLUDE overall_header.html -->

<h2>About Us</h2>

<div class="panel">
   <div class="inner"><span class="corners-top"><span></span></span>

   <div class="content">
      <p>
         We were founded this year to bring you the best forum on the Internet!
         
         We promise to do the following:
         <ul>
            <li>Provide new content</li>
            <li>provide a friendly atmosphere</li>
            <li>Provide an environment where you can have fun!</li>
         </ul>
      </p>
   </div>

   <span class="corners-bottom"><span></span></span></div>
</div>

<!-- INCLUDE jumpbox.html -->
<!-- INCLUDE overall_footer.html -->
Why wont it work?
Im only new to this so go easy on me :)

Cheers

User avatar
Lumpy Burgertushie
Registered User
Posts: 67243
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: Moving .php files into folders?

Post by Lumpy Burgertushie »

you already asked this in another post.

you will get better support if you keep it all in one place.


robert
I'm baaaaaccckkkk. still doing work on donation basis. PM your needs.

Premium phpBB 3.3 Styles by PlanetStyles.net

If nobody is in the forest, does a tree really fall?

AussieFishKeeping
Registered User
Posts: 60
Joined: Tue Apr 12, 2011 6:47 am

Re: Moving .php files into folders?

Post by AussieFishKeeping »

Ok so i was playing around with my file directory and copied my whole root folders + .php an placed it in the folder i want and it worked. What is in the root that makes it work?

AussieFishKeeping
Registered User
Posts: 60
Joined: Tue Apr 12, 2011 6:47 am

Re: New custom pages.

Post by AussieFishKeeping »

manic2 wrote:I've always used this at the bottom of my php files:-
$template->set_filenames(array(
'body' => 'name_of_folder/name_of_file.html',
));
This points to (say for prosilver):-
\styles\prosilver\template\name_of_folder\name_of_file.html

(my php files are in the root)
Awesome, thank you.


I got the .phpbb file to work in it's own folder by copying,
adm
cache
includes
language
styles
common.php
config.php
style.php
And placing them in the folder with the .php file I need to use.
Is seems like a lot of work, is there any other way to do this? I really need an answer to this I want to get started on the pages.
Cheers

manic2
Registered User
Posts: 435
Joined: Thu Jun 12, 2008 9:16 pm

Re: New custom pages.

Post by manic2 »

AusraliaFfishKeeping wrote:I got the .phpbb file to work in it's own folder by copying,
adm
cache
includes
language
styles
common.php
config.php
style.php
And placing them in the folder with the .php file I need to use.
Is seems like a lot of work, is there any other way to do this? I really need an answer to this I want to get started on the pages.
Cheers
Seriously don't think that this is a good idea!

In your .php file try replacing:-

Code: Select all

$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
with:-

Code: Select all

$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '../';
Note I've no idea if this is the correct way to do it but it seems to work!
manic

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51933
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: New custom pages.

Post by Brf »

As I said:
Brf wrote:Your root_path needs to be the relative path to your phpbb's root folder.
You need to adjust the root_path variable, so it points to your phpBB's root folder. If you told us what folder your phpBB is in, and what folder your custom page is in, we could tell you what to use.

Locked

Return to “[3.0.x] MOD Writers Discussion”