PDA

View Full Version : Content from externals Scripts (non vb) in a module


Acido
05-30-2004, 12:32 PM
Do you have a cool script and do you want their content in a cmps module?

Follow this steps:

1) Create a template for use in adv portal cmps with a single line: $output
As example i named a template called adv_portal_test:
$output

2) Create a file as the follow:

<?php
ob_start();
require("/www/path/to/your/file.php");
$output = ob_get_contents();
ob_end_clean();
eval('$home[$mods[\'modid\']][\'content\'] .= "' . fetch_template('adv_portal_test') . '";');

?>

Be sure that rename the template and the php file to match your work.

3) Upload the php file to the modules folder.

4) Create a new module pointed to the php file, and your template.

Is Done :)

I use it to put in a module the content of a scritp that parse RSS news.
Take a look:

http://www.webconferencia.net/foros/cmps_index.php?page=clarin

You can use this steps to include in a CMPS module any cool script the you have in your server.

Enjoy and Please, share ideas !

phoenixdown
06-02-2004, 11:20 PM
Very handy!!

Our Sponsors
 

TYorke
06-05-2004, 06:13 PM
Maybe I'm missing something. I got an SQL error :D

Acido
06-05-2004, 06:44 PM
It should come from the source script. This script have not SQL :)

Our Sponsors
 

TYorke
06-05-2004, 07:04 PM
It should come from the source script. This script have not SQL :)

SPANISH:

Te refieres a mi script? porque mi script tiene codigo de SQL que hace queries a otro table.

ENGLISH:

You mean my script? because my script has SQL code in it that queries a different table

:) :) :)

Acido
06-05-2004, 07:17 PM
SPANISH:

Te refieres a mi script? porque mi script tiene codigo de SQL que hace queries a otro table.

ENGLISH:

You mean my script? because my script has SQL code in it that queries a different table

:) :) :)Yes. your "file.php" most have an error. The script posted in this thread, have not sql.
Sent me a PM and i try to give you some help (if i can)

;)

Spanish: Si me mandas un privado y me cuentas con que estas trabajando veo si te puedo dar una mano, ok?

InsaneContender
06-06-2004, 01:03 AM
Does not work with 4images.

RiSE
07-28-2004, 04:36 AM
Wow. This helped me soooo MUCH. Thanks a lot.

juanchi
07-28-2004, 12:33 PM
Does not work with 4images.
Anyone know why this doesn’t work with 4images, thanks.

Acido
07-28-2004, 12:41 PM
Anyone know why this doesn’t work with 4images, thanks.
4images is an aplication software with many scripts working togheter. This mod parse php code from a single script.

vorphalack
07-30-2004, 09:23 PM
Can anyone tell me how I can get a database search in a VB page? I think these instructions are the closest I've come to doing this, but it's still not working. I don't think the script that I found (single page script) works on its own either lol

I don't know anything about PHP, maybe that's why I'm having so much trouble :( Currently the data we need to search is in another table, I'd like to keep it that way but could move it into the VB table if needed. I'd just love to be able to search and see the results in a VB page! :D

hani
08-29-2004, 06:15 AM
Ok, now for a stupid question if you dont mind
How can I have this in a box and a title (Block)?

please forgive my ignorance, but I guess I'll learn fast if you allow me to :|

Webber
09-01-2004, 12:28 PM
I have a question......how would I pull in an CGI script with this method? I ask because the file.php is calling for a php file..

What I want to do is pull some cgi scripts into my portal. I am very new to VB and PHP --- a noobe LOL

Any help is greatly appreciated.

Samir
09-04-2004, 08:30 PM
I don't know exactly how to do it, but here's what I think should be required based on my understanding of the logic of the php verision that works. I think the logic is something like this: the php file evaluates the other php file and puts the result into a variabled that is passed to the template, which displays it. With that being said, I think that if there was a way to get the cgi output into the variable, then it would work similarly. Now I don't know if there is a way to do that as I am not too familiar with php. :(

But I do remember a hack from vb.org that might help. Here's the link:
http://www.vbulletin.org/forum/showthread.php?t=66084

Samir
09-05-2004, 07:18 PM
Question on this--can you pass more than one variable, such as $output1 and $output2? (if you modify the code, to read 2 files of course). I'm using this logic and building in the php function into this one and need to pass 2 variables, but I keep getting errors that won't even allow cmps to come up unless I disable the module.

fuse3k
09-15-2004, 02:30 PM
I'm getting a few SQL errors when trying to display the module. The script is working fine if you link directly to it, however.

Warning: main(./includes/mysql.php): failed to open stream: No such file or directory in /home2/fuse3k/public_html/downloads/pafiledb.php on line 29

Fatal error: main(): Failed opening required './includes/mysql.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home2/fuse3k/public_html/downloads/pafiledb.php on line 29


This is a 'one-file' php script. Additionally, I've seen another VBA site that had this script integrated into it as a module. I'm not sure if they followed these instructions to do it or not, but I can't see any reason why this wouldn't work. Anyone have any ideas?

TIA,

fuse3k

Acido
09-15-2004, 02:48 PM
What say the line line 29 in the pafiledb.php script?

fuse3k
09-15-2004, 02:50 PM
pafiledb.php, Line29:

require "./includes/mysql.php";

Acido
09-15-2004, 02:56 PM
pafiledb.php, Line29:

require "./includes/mysql.php";try change ./includes/mysql.php with the entire path to the file mysql.php
Example: /yourhost/htdocs/..../includes/mysql.php

Think that the script pafiledb.php is now working on the folder where you have installed vbulletin. Then perhaps you need touch some paths inside the scritp.

Hope help.

Samir
09-15-2004, 02:57 PM
Question on this--can you pass more than one variable, such as $output1 and $output2? (if you modify the code, to read 2 files of course). I'm using this logic and building in the php function into this one and need to pass 2 variables, but I keep getting errors that won't even allow cmps to come up unless I disable the module.

Answer to this question is yes. You can have as many variables as you want (or whatever the technical limit is for php or html.)

Samir
09-15-2004, 02:59 PM
To start, can the script reach the php files in the include directory with the path as is? If not, that is the first problem. I've run across a similar problem with the featured article module hack, but I haven't been able to fix it, so I just can't use it. :(

fuse3k
09-15-2004, 10:20 PM
nevermind, new to custom writing php and I have obviously missed a few chapters.

fuse3k
10-20-2004, 02:50 PM
Question - is there an issue making MySQL connections through this script?

As an example I added this to a script:

require_once('../sql/sql_connect_clients.php'); // SQL connection script
mysql_close();

This is a pretty basic attempt but it seems as if it's trying to search the 'fuse3k_home' database for vb3 tables. Here's the error I get:

Database error in vBulletin 3.0.3:

Invalid SQL:
SELECT template
FROM vb3_template
WHERE templateid = 532

mysql error: Table 'fuse3k_home.vb3_template' doesn't exist

mysql error number: 1146

'fuse3k_home' is my own database I've created for my script. The vBulletin database is called 'fuse3k_vb3'. With that said, what would cause it to look for 'fuse3k_home.vb3_template'


Any suggestions would be greatly appreciated, as always. Thanks in advance.

-Brian

Samir
10-20-2004, 03:36 PM
I'd look into the require_once function to make sure it isn't adding the template part.

fuse3k
10-20-2004, 03:57 PM
Thanks for replying Samir. In response, I wrote that require script myself. It makes no reference to vBulletin in any way...which is why I find this so strange:

It's nothing more then a script to connect to MySQL:


<?php

// ---------------------------------
// Define MySQL Connection Constants
// ---------------------------------

define ('DB_USER', 'fuse3k_mysql');
define ('DB_PASSWORD', '**********');
define ('DB_HOST', 'localhost');
define ('DB_NAME', 'fuse3k_home');

// ---------------------------------------
// Make The Connection And Select Database
// ---------------------------------------

$dbc = @mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) or DIE ('<BR>Could not connect to MySQL Database. The following errors were generated<p><i>' . mysql_error() . '</i>');
@mysql_select_db (DB_NAME) or DIE ('<BR>Could not connect to MySQL Database. The following errors were generated<p><i>' . mysql_error() . '</i>');

?>

Samir
10-20-2004, 08:00 PM
It could be something your isp is adding, now that I think about it. I know my isp needs to have a special db name for it to work.

The other thing I'd try is to make some code to just display all the tables from your script and see what it comes up with. I don't see any reason to have that part appended to your table name.

fuse3k
10-20-2004, 09:02 PM
Well if you're referring to my ISP - I doubt that's the reason. I've tried this from multiple ISP's including my corporate network at work. If you're referring to my Web Host, I doubt that's the case either considering the script works as intended externally, just not through the portal. I appreciate the insight though.

Any other ideas? Anyone?

The other thing I'd try is to make some code to just display all the tables from your script and see what it comes up with. I don't see any reason to have that part appended to your table name.

I don't quite follow you here. Can you elaborate?

Samir
10-21-2004, 02:21 PM
If you're referring to my Web Host...
That is what I meant. My bad!
I don't quite follow you here. Can you elaborate?
Since your script is trying to access the database, make it simply display all the table names and see what it comes up with. If every table name has that .vb_template appended to it (or not), it might bring some insight as to what's going on.

fuse3k
10-21-2004, 11:10 PM
Well I got it to work. Instead of having my own database with my own tables I just added the tables to the vbulletin database and it worked perfectly. It must be something that vbulletin has hard coded that prevents sql connection to a different database.

Thanks for the help Samir.

Samir
10-22-2004, 11:27 AM
That's strange. I know my web host does some funny things with mysql access compared to my local test server. Oh well, as long as it works.

bkbelew
11-21-2004, 12:11 AM
Ok, i have a question.. im trying to include a login page from a webmail program called horde.


everytime i try something, either a) the page shows up without what im wanting or b) the page never loads.

I tried making a template with a php include in it, failed.. i take it the templates dont accept php. tried making a seperate file and placing it in the modules folder.. and calling it from vbadvanced.. failed.. screen never loaded.

the file im wanting to include is http://webmail.fraghard.com/horde/index.php

Can anyone help?


P.S while im on this subject.. the php ventrilo status scripts located on this page
http://www.ventrilo.com/download.php

would be an excellent module for vbadvanced ;)

Samir
11-22-2004, 02:22 AM
At some point, I'll have to design a module like this for use with squirrelMail and also phpadsnew for login through a box. I'm sure I'll have to do a lot of the same things to get those to work. One of the things I was going to do is make a template that had all the forms code from their login screen. Do a "View Source" and look at the source html and see if you can make a template that can work.

bkbelew
11-22-2004, 02:25 AM
i figured it out to an extent, i got a webmail login box on there after a few hours of screwing around with it.. then my boss tells me " Wheres the create a account button" He wants a program to serve out free email accounts. Dont know if its possible since our server is running plesk.. any ideas?

Samir
11-22-2004, 02:38 AM
That's a tuffy. I'm not familiar with plesk, but if setting up new email accounts requires an admin, then it's going to be a complicated script and some custom programming, and that's only a wild guess. Where's the link for the webmail login? I'd really like to see it.

bkbelew
11-22-2004, 02:45 AM
http://forums.fraghard.com/cmps_index.php
::edit:: that template only works under the theme oivar

Plesk is cool, but its really hard to understand how it works. It uses horde as its webmail and Courier-IMAP im sure its possible to automate it, the script would have to add users to the domain mail database, enable a quota for it, and enable spam filtering. I emailed plesk and asked them if they knew of any companys making a automation software for it. Its got capabilities to be automated for hosting.. http://www.sw-soft.com/en/telco/ so im assuming someones done it .

mixmakers
06-07-2005, 04:47 PM
Can you please explain to me how i go about fixing this error:

Warning: main(/home/mixmake/public_html/forums/news/index.php ): failed to open stream: No such file or directory in /modules/php.php on line 4



Fatal error: main(): Failed opening required '/home/mixmake/public_html/forums/news/index.php ' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/mixmake/public_html/forums/modules/php.php on line 4



- In the first part of the error, my "php.php" file is located in /forums/modules/php.php , not /modules/php.php...So i don't know how that came about.



Any help would be appreciated..thanks



here is the file:





<?php

ob_start();

require("/home/mixmaker/public_html/forums/news/index.php

");

$output = ob_get_contents();

ob_end_clean();

eval('$home[$mods[\'modid\']][\'content\'] .= "' . fetch_template('adv_portal_php') . '";');

?>