Page Index Toggle Pages: 1 [2] 3 
There are no actions to perform.
Very Hot Topic (More than 25 Replies) Add php include to perl (Read 14,053 times)
JonB
YaBB Administrator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Offline



Posts: 4,228
Location: Land of the Blazing Sun!

YaBB 2.6.1
Re: Add php include to perl
Reply #15 - May 18th, 2012 at 12:18am
There are no actions to perform.
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
 
JonB
YaBB Administrator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Offline



Posts: 4,228
Location: Land of the Blazing Sun!

YaBB 2.6.1
Re: Add php include to perl
Reply #16 - May 18th, 2012 at 12:22am
There are no actions to perform.
« Last Edit: May 18th, 2012 at 12:27am 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 #17 - May 18th, 2012 at 12:31am
There are no actions to perform.
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
 
westwegoman
Ex Member
**




None
Re: Add php include to perl
Reply #18 - May 18th, 2012 at 1:03am
There are no actions to perform.
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 »  
Back to top
 
IP Logged
 
Dandello
YaBB Administrator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Offline



Posts: 2,924
Location: Earth

YaBB 2.6.1
Re: Add php include to perl
Reply #19 - May 18th, 2012 at 3:19am
There are no actions to perform.
In point of fact, if the file you want to include is straight text or html, it can be included in a Perl file by 'simply' opening the file and reading it into a variable - like Derek said. And the place for the code to open the file and read it is the templates subroutine in Subs.pl

I say 'simply' because Perl really has no exact equivalent to 'include' (PHP) or 'include virtual' (SSI).

The issue here is going to be where your host says that file has to be for Perl and php to both read it.

I have one host where I can use a single file in the root and it can be included in both the static shtml files AND into the Perl files.

I have another host where the shtml files cannot include text files stored in the cgi-bin and Perl can't open text files NOT in the cgi-bin. (But javascripts are fine and so are images.)

So it IS doable.
« Last Edit: May 18th, 2012 at 3:28am by Dandello »  

If you only have one solution to a problem you're not trying hard enough!
Back to top
WWW  
IP Logged
 
Derek B
YaBB Newcomer
*
Offline



Posts: 1
Re: Add php include to perl
Reply #20 - May 18th, 2012 at 3:29am
There are no actions to perform.
Grrrr!!! I don't know who increased the speed posting time, but it just temporarily banned me from posting for hitting the button too fast. I could read the Observer waiting for that. Cheesy

Anyway, I was about to post this before I got the boot:

Yep. I know what you mean, I just didn't know that you wanted to include the same files with PHP too.

Anyway, I've got it working for myself, but you might have to experiment a little to get it to work for you. I don't have to use a cgi-bin either, so I don't know if that will make a difference. Also note that I can only get this working with placing the include files in the yabb2 directory.

Similar to before - put your header HTML in a file called 'header.tpl' and your footer HTML in a file called 'footer.tpl', and upload them to your yabb2/Templates directory.

Then in Sources/Subs.pl find:

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


And add after:

Code (Perl)
Select All
á á fopen(HEADER, "$templatesdir/header.tpl");
á á @head = <HEADER>;
á á fclose(HEADER);
á á $header = join("", @head);
á á
á á fopen(FOOTER, "$templatesdir/footer.tpl");
á á @foot = <FOOTER>;
á á fclose(FOOTER);
á á $footer = join("", @foot);

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


Then place the YaBB tags in your main yourtemplate.html file where you want your header and footer to be included:

Code (Perl)
Select All
{yabb header} 


And:

Code (Perl)
Select All
{yabb footer} 


Then you should be able to include the same files with PHP - you'll have to experiment with the paths a little, depending on where your PHP files are (that's if you can include files in the cgi-bin - I haven't been able to test that):

Code (PHP)
Select All
include 'cgi-bin/yabb2/Templates/header.tpl';
include 'cgi-bin/yabb2/Templates/footer.tpl'; 


Derek
« Last Edit: May 18th, 2012 at 4:15am by Derek B »  
Back to top
 
IP Logged
 
westwegoman
Ex Member
**




None
Re: Add php include to perl
Reply #21 - May 18th, 2012 at 3:33am
There are no actions to perform.
Thank you all. I'm going to give this a shot next chance i have. If it works, great. If not, no big deal.

Thanks for all your time.
  
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 #22 - May 18th, 2012 at 3:41am
There are no actions to perform.
Whahey! I'm back! Roll Eyes
  
Back to top
 
IP Logged
 
westwegoman
Ex Member
**




None
Re: Add php include to perl
Reply #23 - May 18th, 2012 at 5:51am
There are no actions to perform.
Derek Barnstorm wrote on May 18th, 2012 at 3:41am:
Whahey! I'm back! 

Where did you go?
  
Back to top
 
IP Logged
 
Bill Myers
God Member
Beta Testers
*****
Offline



Posts: 1,829
Location: Los Angeles

YaBB 2.4
Re: Add php include to perl
Reply #24 - May 18th, 2012 at 6:51am
There are no actions to perform.
I guess I'm missing something here.  Huh

To modify my YaBB's header or footer I simply go to Admin Center, and then Template.
  

Morning, noon, or night, have a great one!

Note: Like most others, this forum doesn't allow us to freely edit our posts or topics to make corrections as needed, so please remember to look for subsequent posts if you see any mistakes or outdated information. Sorry for the inconvenience.
Back to top
IP Logged
 
westwegoman
Ex Member
**




None
Re: Add php include to perl
Reply #25 - May 18th, 2012 at 6:54am
There are no actions to perform.
Bill Myers wrote on May 18th, 2012 at 6:51am:
To modify my YaBB's header or footer I simply go to Admin Center, and then Template.

Thats what I also do now. I want to try to do something where I edit one file and it changes in YaBB and in the php files that I have all in one shot.
  
Back to top
 
IP Logged
 
JonB
YaBB Administrator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Offline



Posts: 4,228
Location: Land of the Blazing Sun!

YaBB 2.6.1
Re: Add php include to perl
Reply #26 - May 18th, 2012 at 7:03am
There are no actions to perform.
Derek hit the posting rate 'speed-bump'. It autobahns you.  Cheesy


* JonB snarfs and giggles

Cool
  

I find your lack of faith disturbing.
Back to top
IP Logged
 
Bill Myers
God Member
Beta Testers
*****
Offline



Posts: 1,829
Location: Los Angeles

YaBB 2.4
Re: Add php include to perl
Reply #27 - May 18th, 2012 at 7:18am
There are no actions to perform.
westwegoman wrote on May 18th, 2012 at 6:54am:
Thats what I also do now. I want to try to do something where I edit one file and it changes in YaBB and in the php files that I have all in one shot.

But the template file is one shot, isn't it? áHuh At least for me it is.  Wink

On a related note, I regularly update just one file that's in an iFrame on thousands of pages so that all of those pages get updated automatically.

***************************************

JonB wrote on May 18th, 2012 at 7:03am:
Derek hit the posting rate 'speed-bump'. It autobahns you. áCheesy


* JonB snarfs and giggles

Cool

I hit that speed bump all the time. áSmiley
  

Morning, noon, or night, have a great one!

Note: Like most others, this forum doesn't allow us to freely edit our posts or topics to make corrections as needed, so please remember to look for subsequent posts if you see any mistakes or outdated information. Sorry for the inconvenience.
Back to top
IP Logged
 
westwegoman
Ex Member
**




None
Re: Add php include to perl
Reply #28 - May 18th, 2012 at 7:39am
There are no actions to perform.
Bill Myers wrote on May 18th, 2012 at 7:18am:
But the template file is one shot, isn't it?

Yes it is. I want it to update on YaBB as well as all of my php pages also.

Just finished adding it and it works like a charm on php pages and YaBB.

Derek and the crew comes through once again Smiley

I'm learning something new every day.
  
Back to top
 
IP Logged
 
Bill Myers
God Member
Beta Testers
*****
Offline



Posts: 1,829
Location: Los Angeles

YaBB 2.4
Re: Add php include to perl
Reply #29 - May 18th, 2012 at 7:44am
There are no actions to perform.
Excellent, Merv, excellent!

Now if we can just get this forum to install at least one anti-spam mod. Then we won't have to keep wading through the spam when this forum gets hit.

As of this typing, 11 spam posts have been made, which I guess will remain online until sometime tomorrow (or later today) when JonB gets back to swat them away.

Edited:
Edited to correct a typo.  Roll Eyes
« Last Edit: May 18th, 2012 at 7:46am by Bill Myers »  

Morning, noon, or night, have a great one!

Note: Like most others, this forum doesn't allow us to freely edit our posts or topics to make corrections as needed, so please remember to look for subsequent posts if you see any mistakes or outdated information. Sorry for the inconvenience.
Back to top
IP Logged
 
Page Index Toggle Pages: 1 [2] 3 
There are no actions to perform.