Page Index Toggle Pages: [1] 2 3 
Topic Tools
Very Hot Topic (More than 25 Replies) Add php include to perl (Read 12,290 times)
Dandello
YaBB Administrator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Offline



Posts: 2,264
Location: Earth

YaBB 2.6.0
Re: Add php include to perl
Reply #33 - Aug 10th, 2012 at 4:13pm
Post Tools
This Topic was moved here from Non-YaBB Programming and Technical Help [move by] Dandello.
  

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 #32 - May 18th, 2012 at 1:08pm
Post Tools
WestwegoMan wrote on May 18th, 2012 at 7:39am:
Just finished adding it and it works like a charm on php pages and YaBB.

Derek and the crew comes through once again

Great! Smiley

JonB wrote on May 18th, 2012 at 7:03am:
* JonB snarfs and giggles

He he! Grin
  
Back to top
 
IP Logged
 
Bill Myers
God Member
Beta Testers
*****
Offline



Posts: 1,606
Location: Los Angeles

YaBB 2.4
Re: Add php include to perl
Reply #31 - May 18th, 2012 at 7:58am
Post Tools
WestwegoMan wrote on May 18th, 2012 at 7:54am:
Spamtards!!!

What a great word!  Grin
  

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

Note: This forum doesn't allow for 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 #30 - May 18th, 2012 at 7:54am
Post Tools
Bill Myers wrote on May 18th, 2012 at 7:44am:
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.

I know what you mean. I tested the header includes out on my YaBB 3 test forum first... In the 10 minutes that I had it out of maintenance mode, 2 spammers registered. Its like they were standing there waiting for me to open the gates. geesh!!! Spamtards!!!
  
Back to top
 
IP Logged
 
Bill Myers
God Member
Beta Testers
*****
Offline



Posts: 1,606
Location: Los Angeles

YaBB 2.4
Re: Add php include to perl
Reply #29 - May 18th, 2012 at 7:44am
Post Tools
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: This forum doesn't allow for 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
Post Tools
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,606
Location: Los Angeles

YaBB 2.4
Re: Add php include to perl
Reply #27 - May 18th, 2012 at 7:18am
Post Tools
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: This forum doesn't allow for 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
 
JonB
YaBB Administrator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Offline



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

YaBB 2.6.0
Re: Add php include to perl
Reply #26 - May 18th, 2012 at 7:03am
Post Tools
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
 
westwegoman
Ex Member
**




None
Re: Add php include to perl
Reply #25 - May 18th, 2012 at 6:54am
Post Tools
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
 
Bill Myers
God Member
Beta Testers
*****
Offline



Posts: 1,606
Location: Los Angeles

YaBB 2.4
Re: Add php include to perl
Reply #24 - May 18th, 2012 at 6:51am
Post Tools
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: This forum doesn't allow for 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 #23 - May 18th, 2012 at 5:51am
Post Tools
Derek Barnstorm wrote on May 18th, 2012 at 3:41am:
Whahey! I'm back! 

Where did you go?
  
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
Post Tools
Whahey! I'm back! Roll Eyes
  
Back to top
 
IP Logged
 
westwegoman
Ex Member
**




None
Re: Add php include to perl
Reply #21 - May 18th, 2012 at 3:33am
Post Tools
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 B
YaBB Newcomer
*
Offline



Posts: 1
Re: Add php include to perl
Reply #20 - May 18th, 2012 at 3:29am
Post Tools
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
 
Dandello
YaBB Administrator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Offline



Posts: 2,264
Location: Earth

YaBB 2.6.0
Re: Add php include to perl
Reply #19 - May 18th, 2012 at 3:19am
Post Tools
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
 
Page Index Toggle Pages: [1] 2 3 
Topic Tools
 
  « Board Index ‹ Board  ^Top