vBadvanced Forums  
Go Back   vBadvanced Forums > vBadvanced Products > vBadvanced CMPS > Add-On Modules & Modifications > Module & Modification Discussion & Requests

Reply
 
Thread Tools Display Modes
  #1  
Old 11-12-2005, 06:40 AM
jim6763nva jim6763nva is offline
Senior Member
 
Join Date: Oct 2005
Location: Manassas, Virginia
Posts: 139
Default Trying to create a php module...

I'm trying to create a php module/page that will generate a list of links with descriptions and a thumbname image for each link. When a user clicks on a link it will prompt them to download or open the file assocated with that link.
The list of links will look similar to the attached screen shot.

I've created my php file with the following code:

worldslist.php
PHP Code:
<?php
$query 
"SELECT * FROM fc_worlds";
$result $db->query_read($query);
while(
$worldlist $db->fetch_array($result)) {
echo 
"<pre>";
print_r($worldlist);
echo 
"</pre>";
//  eval('$home[$mods[\'modid\']][\'content\'] = "' . fetch_template('adv_portal_worlds') . '";');
}
?>
I've created my template called adv_portal_worlds. When I create a php page module, and run it.. I get the following errors:

Warning: main(): open_basedir restriction in effect. File(/forums/modules/worldlist.php) is not within the allowed path(s): (/home3/wheezier:/usr/lib/php:/usr/local/lib/php:/tmp) in /includes/vba_cmps_include_bottom.php on line 348

Warning: main(/forums/modules/worldlist.php): failed to open stream: Operation not permitted in /includes/vba_cmps_include_bottom.php on line 348

Warning: main(): open_basedir restriction in effect. File(/forums/modules/worldlist.php) is not within the allowed path(s): (/home3/wheezier:/usr/lib/php:/usr/local/lib/php:/tmp) in /includes/vba_cmps_include_bottom.php on line 348

Warning: main(/forums/modules/worldlist.php): failed to open stream: Operation not permitted in /includes/vba_cmps_include_bottom.php on line 348

Fatal error: main(): Failed opening required '/forums/modules/worldlist.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home3/wheezier/public_html/forums/includes/vba_cmps_include_bottom.php on line 348

Any idea what I'm doing wrong?

Thank you in advance for any help anyone can give,
Jim

admin
http://www.nova-classifieds.com
http://www.friendship-cafe.com
Reply With Quote
  #2  
Old 11-12-2005, 08:09 AM
jim6763nva jim6763nva is offline
Senior Member
 
Join Date: Oct 2005
Location: Manassas, Virginia
Posts: 139
Default Re: Trying to create a php module...

Ok.. I fixed the include errors I was getting by changing the path for the included php file to "./modules/worldlist.php". The issue I'm running into now is that my content isn't displaying when I reference my template.
Reply With Quote
  #3  
Old 11-12-2005, 12:02 PM
Brian's Avatar
Brian Brian is offline
Administrator
 
Join Date: Jan 2004
Location: Georgia, USA
Posts: 34,240
Default Re: Trying to create a php module...

How were you able to change the path to include like that? When adding PHP file modules you should only be able to select the module from a drop-down list...
Reply With Quote
  #4  
Old 11-12-2005, 12:45 PM
jim6763nva jim6763nva is offline
Senior Member
 
Join Date: Oct 2005
Location: Manassas, Virginia
Posts: 139
Default Re: Trying to create a php module...

Quote:
Originally Posted by Brian
How were you able to change the path to include like that? When adding PHP file modules you should only be able to select the module from a drop-down list...

Well, I've tried this two ways.. Adding a php file as a page and as a module. So far I've gotten it to work partially by using the module method. When adding a php file as a page, I don't get a drop-down box, only a text box to type in the path to the file I want to include. I can't get the "php page" method to work. For some reason it's not connecting with the template.

One of the [other] problems I'm running into now is that I can't get the template to loop through each record. It looks like it only captures the last record and displays it.

If you go to http://www.friendship-cafe.com you will see what it looks like right below the welcome message.

Jim
Reply With Quote
  #5  
Old 11-12-2005, 01:36 PM
Brian's Avatar
Brian Brian is offline
Administrator
 
Join Date: Jan 2004
Location: Georgia, USA
Posts: 34,240
Default Re: Trying to create a php module...

If you're trying to add it as a page, try using './modules/wordlist.php' as the file to include instead. Normally you should be able to use the full path, but you won't be able to since your host has the open_basedir restriction turned on.

Quote:
One of the [other] problems I'm running into now is that I can't get the template to loop through each record. It looks like it only captures the last record and displays it.

If you go to http://www.friendship-cafe.com you will see what it looks like right below the welcome message.
I'm not seeing anything on the page... After your welcome block is the news module.
Reply With Quote
  #6  
Old 11-12-2005, 01:44 PM
jim6763nva jim6763nva is offline
Senior Member
 
Join Date: Oct 2005
Location: Manassas, Virginia
Posts: 139
Default Re: Trying to create a php module...

Quote:
Originally Posted by Brian
If you're trying to add it as a page, try using './modules/wordlist.php' as the file to include instead. Normally you should be able to use the full path, but you won't be able to since your host has the open_basedir restriction turned on.


I'm not seeing anything on the page... After your welcome block is the news module.
I already have './modules/worldlist.php' as the file to include.. and it still doesn't display anything. Only when adding the php file as a module will it display something.
Reply With Quote
  #7  
Old 11-13-2005, 10:36 AM
Brian's Avatar
Brian Brian is offline
Administrator
 
Join Date: Jan 2004
Location: Georgia, USA
Posts: 34,240
Default Re: Trying to create a php module...

A file that was created to work as a module will not work when trying to include it in a new CMPS page. If you change the code so that the text is echoed out instead though then it should work when including it in a page.
Reply With Quote
  #8  
Old 11-13-2005, 12:03 PM
jim6763nva jim6763nva is offline
Senior Member
 
Join Date: Oct 2005
Location: Manassas, Virginia
Posts: 139
Default Re: Trying to create a php module...

Quote:
Originally Posted by Brian
A file that was created to work as a module will not work when trying to include it in a new CMPS page. If you change the code so that the text is echoed out instead though then it should work when including it in a page.
Oh!!! This is definately a big help and piece to the puzzle. Many thanks Brian, I'll give that a shot.

Jim
Reply With Quote
  #9  
Old 11-13-2005, 05:03 PM
jim6763nva jim6763nva is offline
Senior Member
 
Join Date: Oct 2005
Location: Manassas, Virginia
Posts: 139
Default Re: Trying to create a php module...

Quote:
Originally Posted by Brian
A file that was created to work as a module will not work when trying to include it in a new CMPS page. If you change the code so that the text is echoed out instead though then it should work when including it in a page.
Ok, I thought I understood what you meant.. so as a test what I did was.. I created a new php file and added the following code:

PHP Code:
<?php

echo "hello world";

?>
Then followed the screens for adding a PHP page. When I click on the link, I don't get any output to the screen. I only get the left and right sidebars. I disabled everything else in the center column.
Reply With Quote
  #10  
Old 11-15-2005, 01:27 PM
Brian's Avatar
Brian Brian is offline
Administrator
 
Join Date: Jan 2004
Location: Georgia, USA
Posts: 34,240
Default Re: Trying to create a php module...

Did you make sure that your 'Custom Page Content' module was enabled?
Reply With Quote
  #11  
Old 11-15-2005, 01:30 PM
jim6763nva jim6763nva is offline
Senior Member
 
Join Date: Oct 2005
Location: Manassas, Virginia
Posts: 139
Default Re: Trying to create a php module...

Quote:
Originally Posted by Brian
Did you make sure that your 'Custom Page Content' module was enabled?
Yes, Thanks for getting back Brian.. That was the problem. I enabled that and everything is working now. I think I mentioned this in a different thread, as well as compiled a list of instructions for others to include this... hoping it would help them.

Jim
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Instructions to Create a New Module Deriel Module & Modification Discussion & Requests 0 07-14-2005 10:18 AM
how do you create a module??? cDizzle Chit Chat 1 05-08-2005 06:34 PM
How to create Module that have more than 1 php file ? Lizard King Troubleshooting / "How do I..." Questions 1 03-14-2005 02:06 AM
How to create a AD module on the left ncangler Troubleshooting / "How do I..." Questions 6 02-12-2005 01:35 AM


All times are GMT -4. The time now is 04:29 PM.

Forums Powered by vBulletin, Copyright ©2000-2009, Jelsoft Enterprises Ltd.
Please note that vBadvanced is in no way affiliated with Jelsoft Enterprises Ltd, nor will Jelsoft be able to provide any support for our products.