Firefox PHP

Static pages with template style, was: Template: Global Business

Posted by rchecka 
Static pages with template style, was: Template: Global Business
September 14, 2015 03:44PM
Ok, after many trials and tribulations, I have finally been able to make this template work on all fronts. I am slowly but surely figuring this stuff out! Turns out you can declare the css file in the header and that is what I did along with adjusting the css file in the forum directory.

Anyways, here's what it looks like. I'm thinking it turned out pretty nice. I even made a few helpful HTML help pages that I linked to in the top which hopefully will make BB-Code easier for my non technical members.

In making the HTM files I did notice something. I was unable to "include" the header.tpl and footer.tpl in the HTML pages. Copying the code from the associated files does nothing, so I had to recreate the header and footer look within each HTML page individually. That was a pain, and shouldn't have been necessary and frankly it doesn't look as good as the header and footer look with the regular php code running. The formatting is pretty much off. It looks OK, but I know it can look much better if I can simply call the header and footer from within the HTML.

I have been googling left and right for an answer. I've messed with the .htmaccess file and that didn't help. Basically none of the PHP code works on my HTML pages.

Can anyone get me started down the right path for calling the header.tpl and footer.tpl from within these already created pages? What am I doing wrong?

Hopefully this is the right place to ask this question if not I can recreate it elsewhere.

Thanks,

Joe (rchecka)

[Thread split. Oliver Riesen]



Edited 2 time(s). Last edit at 09/25/2015 03:29AM by Oliver Riesen.
Re: Template: Global Business
September 14, 2015 07:28PM
Simplified...

Rename your .html to .php.
Insert php tags at the top and bottom of the file and ...
Include the header / footer like phorum does.
Re: Template: Global Business
September 16, 2015 12:53PM
^Awesome, that's way easier, I'll do that.

But I must be doing something wrong with my include statement. Can you tell me what file specifically calls the header that I can look at the syntax?
Re: Template: Global Business
September 16, 2015 03:42PM
This isn't any easier at all. I wasted another day effing around with php when my html works just fine except for the header.

Once I add the php tags in the beginning and end it bombs out. The only time I can get the include to work, it does a damn redirect to the 404 not found page!

PLEASE WTF is the answer so I can move on with my life?? Can someone give me the actual syntax because I have read and reread your documentation here for developers 100x and not one place does it tell you how to include the header or footer.
Re: Template: Global Business
September 17, 2015 05:51AM
Perhaps you have a look at the emerald template included in the Phorum core to understand the template system?


Using Phorum since 7/2000: forum.langzeittest.de (actual version 5.2.23)
Modules "Made in Germany" for version 5.2: Author_as_Sender, CarCost, Close_Topic, Conceal_Message_Timestamp,
Format_Email, Index_Structure, Mailing_List, Pervasive_Forum, Spritmonitor, Terms_of_Service and German_Language_Files_Package.
Re: Template: Global Business
September 17, 2015 01:29PM
From common (there are some notes in this file)
Language: PHP
include phorum_get_template("footer");     // Load all constants from ./include/constants.php require_once( "./include/constants.php" );   // Load the API code that is required for all pages. require_once("./include/api/base.php"); require_once("./include/api/user.php");



From Index
Language: PHP
include_once( "./common.php" );   include_once( "./include/format_functions.php" );
Re: Template: Global Business
September 17, 2015 05:07PM
Checking now...



Edited 1 time(s). Last edit at 09/17/2015 05:08PM by rchecka.
Re: Template: Global Business
September 21, 2015 05:32AM
Hi rchecka,

Quote
rchecka
In making the HTM files I did notice something. I was unable to "include" the header.tpl and footer.tpl in the HTML pages. Copying the code from the associated files does nothing, so I had to recreate the header and footer look within each HTML page individually.

Here is some example for such a static page for your BBCode help:

Language: PHP
<?php   // // BBCode Help //   define(';phorum_page';,';bbcode-help';);   include_once(';./common.php';);   // set all our URL';s phorum_build_common_urls();   include phorum_get_template(';header';); phorum_hook(';after_header';);   ?>   <h1>Chapter</h1> <p> some nice help... </p>   <?php   phorum_hook(';before_footer';); include phorum_get_template(';footer';);   ?>

Put the file in the root folder of your forum, for example bbcode-help.php.

Regards
Oliver

P.S. You can also find an example of such a page in the Terms of Service Module.


Using Phorum since 7/2000: forum.langzeittest.de (actual version 5.2.23)
Modules "Made in Germany" for version 5.2: Author_as_Sender, CarCost, Close_Topic, Conceal_Message_Timestamp,
Format_Email, Index_Structure, Mailing_List, Pervasive_Forum, Spritmonitor, Terms_of_Service and German_Language_Files_Package.
Re: Template: Global Business
September 21, 2015 04:38PM
AWESOME OLIVER, THANK YOU!!!

Last question I promise!

Can I include an alternate location for the stylesheet in the PHP code above the HTML code because I want the style sheet to be in the same location of the regular style sheet but it's called "global_style_alt"?

Also since these are special pages can I have the PHP inject an alternate meta description?

I can put whatever HTML I want in the code you gave me but I can't override the stylesheet in that section and I can't override the meta description?

If I can do something like an alt style sheet and alt meta descriptions in the PHP code before it gets to the HTML code it will be perfect!
Re: Template: Global Business
September 24, 2015 10:18AM
Hi rchecka,

Quote
rchecka
Can I include an alternate location for the stylesheet in the PHP code above the HTML code because I want the style sheet to be in the same location of the regular style sheet but it's called "global_style_alt"?

The used template depends on the actual forum. If all your forums uses global_style_alt it is used also for your static page.

Quote
rchecka
Also since these are special pages can I have the PHP inject an alternate meta description?

You can manipulate nearly everything in $PHORUM['DATA'], like this:

Language: PHP
<?php   // // BBCode Help //   define(';phorum_page';,';bbcode-help';);   include_once(';./common.php';);   $PHORUM[';DATA';][';HEADING';] = ';BBCode Help - ';.(isset($PHORUM[';name';]) ? $PHORUM[';name';] : ';';); $PHORUM[';DATA';][';HTML_DESCRIPTION';] = ';Some description for this help page.';; $PHORUM[';DATA';][';BREADCRUMBS';][] = array( ';URL'; => ';/bbcode-help.php?';.$PHORUM[';forum_id';], ';TEXT'; => ';BBCode Help'; );   // set all our URL';s phorum_build_common_urls();   include phorum_get_template(';header';); phorum_hook(';after_header';);   ?>   <h1>Chapter</h1> <p> some nice help... </p>   <?php   phorum_hook(';before_footer';); include phorum_get_template(';footer';);   ?>


Quote
rchecka
I can put whatever HTML I want in the code you gave me

Yes, why not? I'm using this kind of pages in multiple cases: order forms for our mailing list (content of this page depends on the actual forum), order form for our adhesive label, showing the terms of service.

Regards
Oliver


Using Phorum since 7/2000: forum.langzeittest.de (actual version 5.2.23)
Modules "Made in Germany" for version 5.2: Author_as_Sender, CarCost, Close_Topic, Conceal_Message_Timestamp,
Format_Email, Index_Structure, Mailing_List, Pervasive_Forum, Spritmonitor, Terms_of_Service and German_Language_Files_Package.
Re: Template: Global Business
September 24, 2015 01:50PM
Thanks a million Oliver, you have been extremely helpful and I cannot thank you enough!

^^This info right here deserves a post of it's own, this wasn't easy to find and many would benefit from this.
Re: Template: Global Business
September 28, 2015 08:50AM
Hi Joe,

Quote
rchecka
This info right here deserves a post of it's own, this wasn't easy to find and many would benefit from this.

Done: [github.com]

Regards
Oliver


Using Phorum since 7/2000: forum.langzeittest.de (actual version 5.2.23)
Modules "Made in Germany" for version 5.2: Author_as_Sender, CarCost, Close_Topic, Conceal_Message_Timestamp,
Format_Email, Index_Structure, Mailing_List, Pervasive_Forum, Spritmonitor, Terms_of_Service and German_Language_Files_Package.
Sorry, only registered users may post in this forum.

Click here to login