YaBB Community and Support Forum
YaBB Home About YaBB Download YaBB YaBB Support Customize Your Forum Development Contribute to the Project
  Welcome, Guest. Please Login or Register


 
Pages: 1 2 3 
Topic Tools
 
Add php include to perl (Read 8,934 times)
 May 17th, 2012 at 4:05pm
There are no actions to perform.  

westwegoman 
Ex Member
*


YaBB 2.5
Add php include to perl
How would I go about adding a php include statement or something similar to a perl file?

For example, to display things such as a header or footer.
 
Never use both feet to test the depth of the water
 
IP Logged  
 Reply #1 - May 17th, 2012 at 7:19pm
There are no actions to perform.  

Derek Barnstorm 
Support Team
YaBB Next Team
Development Team
Beta Testers
****
Offline
Posts: 1,269
United Kingdom


YaBB 2.5
Re: Add php include to perl
Including (require in Perl) headers and footers won't be as simple to do in Perl as it is in PHP - what exactly are you trying to do? Is this your own script?
 
 
IP Logged  
 Reply #2 - May 17th, 2012 at 7:28pm
There are no actions to perform.  

westwegoman 
Ex Member
*


YaBB 2.5
Re: Add php include to perl
It would be in YaBB. I was thinking of something to include my header at top and my footer above the copyright in it so I would only have those files to play with when a change was needed.

Not a big deal if its really difficult. I thought it might be simular to the way it is done with php.
 
Never use both feet to test the depth of the water
 
IP Logged  
 Reply #3 - May 17th, 2012 at 7:51pm
There are no actions to perform.  

JonB 
YaBB Administrator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Offline
Posts: 3,617
Land of the Blazing Sun!


None
Re: Add php include to perl
Here's something to try -

http://www.phpfreaks.com/forums/index.php?topic=231149.0

NOTE - you may not be able to do this on some shared hosting servers due to server security configuration.

"its just like the cgi-bin issue, you need to be able to execute on the server".

Good Luck & let me know what happens

Wink
 
« Last Edit: May 17th, 2012 at 7:51pm by JonB »  
I find your lack of faith disturbing.
 
IP Logged  
 Reply #4 - May 17th, 2012 at 8:07pm
There are no actions to perform.  

westwegoman 
Ex Member
*


YaBB 2.5
Re: Add php include to perl
JonB wrote on May 17th, 2012 at 7:51pm:
Good Luck & let me know what happens

Thanks, will do.
 
Never use both feet to test the depth of the water
 
IP Logged  
 Reply #5 - May 17th, 2012 at 8:33pm
There are no actions to perform.  

Dandello 
Global Moderator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Offline
Posts: 1,856
Earth


YaBB 2.5
Re: Add php include to perl
You actually have a couple options - you can 'include' the file by using file open/close in sub templates (Subs.pl).

Code Select All
open my $NFILE, '<', 'footer2.tpl';
$footer = <$NFILE>;
close $NFILE;
 


(This is from one of my own sites, so obviously your file name will be different.)
Then put $footer where it belongs in sub templates. Also, in this instance, all the data in the include needs be be on a single line.

You could just add the info from your include to default.html or put the info into a javascript which can then be called by default.html and your other pages as well.

Some hosting services do have restrictions on where you can put 'required' files being called from the cgi-bin. So you may end up with two copies of your included file anyway.
 
WWW  
IP Logged  
 Reply #6 - May 17th, 2012 at 8:42pm
There are no actions to perform.  

Derek Barnstorm 
Support Team
YaBB Next Team
Development Team
Beta Testers
****
Offline
Posts: 1,269
United Kingdom


YaBB 2.5
Re: Add php include to perl
Dandello beat me to it, but another slightly different way within YaBB - pretty much like Dandello suggested...

Create a new file called 'header.pl' and place this code in it with your HTML:

Code (Perl)Select All
$header = qq~

<!-- Your header HTML goes here -->

~;

1; 


And the same thing for the footer - create a new file called 'footer.pl' and place this code in it:

Code (Perl)Select All
$footer = qq~

<!-- Your footer HTML goes here -->

~;

1; 


Upload both files to your yabb2/Templates directory.

Then in Sources/Subs.pl find:

Code (Perl)Select All
    $yydefaultimages = $defaultimagesdir; 


And add after:

Code (Perl)Select All
    require "$templatesdir/header.pl";
    require "$templatesdir/footer.pl";

    $yyheader = $header;
    $yyfooter = $footer; 


You'll then be able to use two new tags...

Code (Perl)Select All
{yabb header} 


...and...

Code (Perl)Select All
{yabb footer} 


...anywhere you want in your main yourtemplate.html file.

Hopefully that's of some help to you and sort of what you mean.

JonB wrote on May 17th, 2012 at 7:51pm:
Here's something to try -

http://www.phpfreaks.com/forums/index.php?topic=231149.0

NOTE - you may not be able to do this on some shared hosting servers due to server security configuration.

"its just like the cgi-bin issue, you need to be able to execute on the server".

Good Luck & let me know what happens

Wink
 

I don't think Merv actually want to inludes PHP files though, I think he just wants to include a HTML header and footer?
« Last Edit: May 17th, 2012 at 9:06pm by Derek Barnstorm »  
 
IP Logged  
 Reply #7 - May 17th, 2012 at 8:45pm
There are no actions to perform.  

westwegoman 
Ex Member
*


YaBB 2.5
Re: Add php include to perl
Maybe I put too much thought into it earlier.

I got to thinking.... Templates/default/default.html is a html file anyway so it actually wouldnt be going into perl anyway...right?

So if im right then this should work but it doesnt.
Code Select All
include('header.php'); 



Still playing around with the paths.
 
Never use both feet to test the depth of the water
 
IP Logged  
 Reply #8 - May 17th, 2012 at 8:48pm
There are no actions to perform.  

Derek Barnstorm 
Support Team
YaBB Next Team
Development Team
Beta Testers
****
Offline
Posts: 1,269
United Kingdom


YaBB 2.5
Re: Add php include to perl
That won't work because 'include' is a PHP statement and therefore will only work within a PHP page. Smiley
 
 
IP Logged  
 Reply #9 - May 17th, 2012 at 8:49pm
There are no actions to perform.  

westwegoman 
Ex Member
*


YaBB 2.5
Re: Add php include to perl
Most of my files are in HTML. I do have a few in php and then there is YaBB. I was thinking that I could upload one file in the root directory and call it header.php or whatever.

Then I edit it, instead of YaBB or any other php file on my site.
 
Never use both feet to test the depth of the water
 
IP Logged  
 Reply #10 - May 17th, 2012 at 8:51pm
There are no actions to perform.  

westwegoman 
Ex Member
*


YaBB 2.5
Re: Add php include to perl
Derek Barnstorm wrote on May 17th, 2012 at 8:48pm:
That won't work because 'include' is a PHP statement and therefore will only work within a PHP page.

Well, that solves that. Thanks for shattering my dreams Cry Grin Cry Grin
 
Never use both feet to test the depth of the water
 
IP Logged  
 Reply #11 - May 17th, 2012 at 8:51pm
There are no actions to perform.  

Derek Barnstorm 
Support Team
YaBB Next Team
Development Team
Beta Testers
****
Offline
Posts: 1,269
United Kingdom


YaBB 2.5
Re: Add php include to perl
westwegoman wrote on May 17th, 2012 at 8:49pm:
Most of my files are in HTML. I do have a few in php and then there is YaBB. I was thinking that I could upload one file in the root directory and call it header.php or whatever.

Then I edit it, instead of YaBB or any other php file on my site.

This will let you do that:

http://www.yabbforum.com/community/YaBB.pl?num=1337270708/6#6
« Last Edit: May 17th, 2012 at 8:52pm by Derek Barnstorm »  
 
IP Logged  
 Reply #12 - May 17th, 2012 at 9:29pm
There are no actions to perform.  

westwegoman 
Ex Member
*


YaBB 2.5
Re: Add php include to perl
OK. will try that after I settle down a bit. I played with something that I found online and added some things to my htaccess file. After I did that, I could access the site by browsing to the .index.htm file but when I used just the domain name, it would try to download a file. After deleting everything I had changed, it still did it.

Oh no....what now Smiley

The solution: Close explorer and re-open. duh  Smiley
 
Never use both feet to test the depth of the water
 
IP Logged  
 Reply #13 - May 17th, 2012 at 10:55pm
There are no actions to perform.  

JonB 
YaBB Administrator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Offline
Posts: 3,617
Land of the Blazing Sun!


None
Re: Add php include to perl
@ derek -

I was just responding to this:

Quote:
How would I go about adding a php include statement or something similar to a perl file?


and besides, LOL, I have been working on that exact issue myself - executing PHP within Perl - bery twicky, bery bery twicky
 OK, where's the Elmer Fudd smiley?

Wink
« Last Edit: May 17th, 2012 at 10:56pm by JonB »  
I find your lack of faith disturbing.
 
IP Logged  
 Reply #14 - May 17th, 2012 at 11:12pm
There are no actions to perform.  

Derek Barnstorm 
Support Team
YaBB Next Team
Development Team
Beta Testers
****
Offline
Posts: 1,269
United Kingdom


YaBB 2.5
Re: Add php include to perl
Ah, okay. I guess we both interpreted it differently. Smiley

Or should that be 'intwerpweted'. ...
« Last Edit: May 17th, 2012 at 11:19pm by Derek Barnstorm »  
 
IP Logged  
Pages: 1 2 3 
Topic Tools
 

Get Yet another Bulletin Board at SourceForge.net. Fast, secure and Free Open Source software downloads Support This Project BoardMod - YaBB features and templates YaBB Codex - support on installation and usage YaBB Toolbar for your browser

YaBB Facebook Group Page

Vulnerability Scanner

Valid RSS Valid XHTML Valid CSS Powered by Perl
YaBB Chat and Support Community » Powered by YaBB 3.0 Beta!
YaBB Forum Software © 2000-2011. All Rights Reserved.