Global Content/PHP includes - By hand or stack?

(Greg Schneck) #1

I currently do php includes by doing the old fashioned way. Coding the snippets and coding the calls into stacks with a normal “php include”.

I know Joe Workman has a stack for includes. Are there any others? Any users of the Workman stack and are you happy with it?

(Brandon Scott Corlett) #2

I have the @joeworkman stacks and they rock.

I would like to learn how to do it by hand for my general knowledge though.

(Greg Schneck) #3
  1. put folder on your server named “includes” (exact name not critical)
  2. put your code snippet in the “includes” folder (such as “footer.html”)
  3. on your RW page put the php call to the snippet <?php $path = $_SERVER['DOCUMENT_ROOT']; $path .= "/includes/footer.html"; include_once($path); ?>

(Greg Schneck) #4

how do you enter “code” on this board?

(Greg Schneck) #5

And the use of php assumes of course it is running and configured on your server. Pages must be .php and not .html or you must configure htaccess to process html as php

(Greg Schneck) #6

Does the Workman Global Content stack work across Projects? I have a site that consists of several project files…

(Varied Team Members) #7

Hello Greg… Thank you for posting this in the forum. I believe I have a similar need. I have a public facing site which can be managed via a single RapidWeaver project but where things get tricky is the membership side. The dashboard pages would live in the main site project while all the content sections would all be individual site projects.

What this requires is that the public facing pages all need one type of header (Nav) and footer while the dashboard pages and individual member content sections, which are designed and published via separate RapidWeaver projects, need second layout for their headers (Nav) and footers.

The goal is to be able to publish any changes to the headers (Nav) and footers from one place. Further the membership content RW Projects would be just that, each content RW Project would simply manage its content and pull the header and footer in via the PHP Include approach. I am curious how you got on with things and if you wouldn’t mind elaborating further?

Kind Regards,