Page Index Toggle Pages: 1 [2] 3 
Topic Tools
 25 Add php include to perl (Read 11,014 times)
westwegoman
Ex Member
**




None
Re: Add php include to perl
Reply #18 - May 18th, 2012 at 1:03am
Post Tools
I wanted to be able to edit one file to update my header and footer in YaBB and the php pages that I have on my site.

I thought I would be able to call for this one file in YaBB and in my php pages.

So, lets say that I need to change something in my header, I would open 'header.php' and edit it. This way I dont even have to touch the other php pages or YaBB.

Earlier I was thinking it would be called for from a perl file but YaBB templates are actually in HTML (default/default.html).

Right now I have the header written within the default.html file in YaBB. This would just save me a step from editing about 8 different files by doing just the one.

Hope I explained that correctly.
« Last Edit: May 18th, 2012 at 1:05am by WestwegoMan »  
<div class=
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 #17 - May 18th, 2012 at 12:31am
Post Tools
I'll have to check that out at some point.

From what I understand though, Merv doesn't actually want to execute any PHP - he just wanted to know an equivalent in Perl to include plain HTML as a header and footer...
  
Back to top
 
IP Logged
 
JonB
YaBB Administrator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Offline



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

YaBB 2.6.0
Re: Add php include to perl
Reply #16 - May 18th, 2012 at 12:22am
Post Tools
« Last Edit: May 18th, 2012 at 12:27am by JonB »  

I find your lack of faith disturbing.
Back to top
IP Logged
 
JonB
YaBB Administrator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Offline



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

YaBB 2.6.0
Re: Add php include to perl
Reply #15 - May 18th, 2012 at 12:18am
Post Tools
Looks like there are methods - formalized -

http://forums.cpanel.net/f42/use-perl-php-same-script-164710.html

Wink
  

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
 
JonB
YaBB Administrator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Offline



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

YaBB 2.6.0
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
 
westwegoman
Ex Member
**




None
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
  
<div class=
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
**




None
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
  
<div class=
Back to top
 
IP Logged
 
westwegoman
Ex Member
**




None
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.
  
<div class=
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
**




None
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.
  
<div class=
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 #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
 
Dandello
YaBB Administrator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Online



Posts: 2,076
Location: Earth

YaBB 2.6.0
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
 
westwegoman
Ex Member
**




None
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.
  
<div class=
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1 [2] 3 
Topic Tools
 
  « Board Index ‹ Board  ^Top