Page Index Toggle Pages: [1] 2 3 
Topic Tools
Very Hot Topic (More than 25 Replies) Add php include to perl (Read 12,662 times)
westwegoman
Ex Member
**




YaBB 2.5.2
Add php include to perl
May 17th, 2012 at 4:05pm
Post Tools
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.
  
Back to top
 
IP Logged
 
Derek Barnstorm
Support Team
YaBB Next Team
Development Team
Beta Testers
****
Offline



Posts: 1,269
Location: United Kingdom

None
Re: Add php include to perl
Reply #1 - May 17th, 2012 at 7:19pm
Post Tools
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?
  
Back to top
 
IP Logged
 
westwegoman
Ex Member
**




YaBB 2.5.2
Re: Add php include to perl
Reply #2 - May 17th, 2012 at 7:28pm
Post Tools
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.
  
Back to top
 
IP Logged
 
JonB
YaBB Administrator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Offline



Posts: 3,913
Location: Land of the Blazing Sun!

YaBB 2.6.1
Re: Add php include to perl
Reply #3 - May 17th, 2012 at 7:51pm
Post Tools
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.
Back to top
IP Logged
 
westwegoman
Ex Member
**




YaBB 2.5.2
Re: Add php include to perl
Reply #4 - May 17th, 2012 at 8:07pm
Post Tools
JonB wrote on May 17th, 2012 at 7:51pm:
Good Luck & let me know what happens

Thanks, will do.
  
Back to top
 
IP Logged
 
Dandello
YaBB Administrator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Offline



Posts: 2,383
Location: Earth

YaBB 2.6.1
Re: Add php include to perl
Reply #5 - May 17th, 2012 at 8:33pm
Post Tools
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.
  

If you only have one solution to a problem you're not trying hard enough!
Back to top
WWW  
IP Logged
 
Derek Barnstorm
Support Team
YaBB Next Team
Development Team
Beta Testers
****
Offline



Posts: 1,269
Location: United Kingdom

None
Re: Add php include to perl
Reply #6 - May 17th, 2012 at 8:42pm
Post Tools
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 »  
Back to top
 
IP Logged
 
westwegoman
Ex Member
**




YaBB 2.5.2
Re: Add php include to perl
Reply #7 - May 17th, 2012 at 8:45pm
Post Tools
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.
  
Back to top
 
IP Logged
 
Derek Barnstorm
Support Team
YaBB Next Team
Development Team
Beta Testers
****
Offline



Posts: 1,269
Location: United Kingdom

None
Re: Add php include to perl
Reply #8 - May 17th, 2012 at 8:48pm
Post Tools
That won't work because 'include' is a PHP statement and therefore will only work within a PHP page. Smiley
  
Back to top
 
IP Logged
 
westwegoman
Ex Member
**




YaBB 2.5.2
Re: Add php include to perl
Reply #9 - May 17th, 2012 at 8:49pm
Post Tools
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.
  
Back to top
 
IP Logged
 
westwegoman
Ex Member
**




YaBB 2.5.2
Re: Add php include to perl
Reply #10 - May 17th, 2012 at 8:51pm
Post Tools
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
  
Back to top
 
IP Logged
 
Derek Barnstorm
Support Team
YaBB Next Team
Development Team
Beta Testers
****
Offline



Posts: 1,269
Location: United Kingdom

None
Re: Add php include to perl
Reply #11 - May 17th, 2012 at 8:51pm
Post Tools
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 »  
Back to top
 
IP Logged
 
westwegoman
Ex Member
**




YaBB 2.5.2
Re: Add php include to perl
Reply #12 - May 17th, 2012 at 9:29pm
Post Tools
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
  
Back to top
 
IP Logged
 
JonB
YaBB Administrator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Offline



Posts: 3,913
Location: Land of the Blazing Sun!

YaBB 2.6.1
Re: Add php include to perl
Reply #13 - May 17th, 2012 at 10:55pm
Post Tools
@ 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.
Back to top
IP Logged
 
Derek Barnstorm
Support Team
YaBB Next Team
Development Team
Beta Testers
****
Offline



Posts: 1,269
Location: United Kingdom

None
Re: Add php include to perl
Reply #14 - May 17th, 2012 at 11:12pm
Post Tools
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 »  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 3 
Topic Tools
 
  « Board Index ‹ Board  ^Top