Accessing core web pages from multiple directories
It's tough to write a cohesive title for the issue I'm having here, so I'll try my best to explain it here.
I have one domain, and within that domain will be six sub-directories (domain.com/site1, domain.com/site2, etc.). The six sites will have the same makeup and same content, so the key content pages will be in other directories. The differences between each of the six sites is aesthetics, so I was going to have PHP dynamically add the second stylesheet (with the site-specific styles) depending on which directory is accessed to achieve that.
Now, the issue I'm having is this. Suppose you are at domain.com/site1 and you click into a content page. The content pages exist only once, and to avoid having the same files six times, they are kept in a separate directory outside of the six site directories from before (so, domain.com/content1, domain.co开发者_开发知识库m/content2, etc.). I want the URL that's displayed to stay within the site directory I'm at, while loading that content (if I'm in site1 and click a link to some content, I'll go to domain.com/site1/content1/page.php instead of domain.com/content1/page.php). That way if you are viewing the content, you're still within the site you started off in.
I hope what I'm asking for makes sense. I can try my best to clarify further if needed. Thanks.
You could try using include
and include_once
, which directly add the text from a specified file as if it was PHP and/or HTML code.
For more information, check out http://php.net/manual/fr/function.include-once.php
精彩评论