itsboyd Posted July 3, 2009 Share Posted July 3, 2009 So, I've got a large number of websites and I want to use a generic/global Terms and Conditions page for all of them. Updating this Terms Page on each site now is a nightmare. So, I've got the Terms Page set up on one of those websites and plan to use something like this on www.mysite2.com/terms.php: <?php include 'http://www.mysite1.com/incs/terms.php' ?> I've successfully done this with all my Privacy Policy pages. Here's the catch, the Privacy Policy stays the same across all sites 100% of the time, so a simple include works fine. But with the Terms Page; they read, ".... your use of MySite2.com (the "website") ...." blah blah blah. So I want to include something like this: <p> Your Use of <?php echo $sitename; ?> (the "website') .... </p> WRAP UP: I have a "Global Terms Page" on ONE website (it's not a full page, just a bunch of text with minimal markup, i.e. <h2><p><ol> etc..... no headers, footers it's an inc file.)This "Global Terms Page" needs to include/print a $variable that is declared from a different site. So you visit Site2's Terms Page, it pulls the content from Site1's Global Terms Page (which has a echo $variable) and then gets displayed on Site2 (which has the $variable declaration) giving you a complete Terms Page on Site2. All Sites are on the same server. I've messed around with echos, includes, functions, globals, fopens and can't get it to work. It just displays the sentence with an extra "space" where the site name should be. Any suggestion? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/164627-global-terms-page-an-echo-include-and-variable-nightmare-help/ Share on other sites More sharing options...
fooDigi Posted July 3, 2009 Share Posted July 3, 2009 i actually have dealt with the same... i use a config script which is generated on the root server side, and each will exist within it's corosponding site's root directory... from there your should be able to query anything that is stored about the site... for all my sites, i have made a database table holding all the "about us", "privacy", etc... let me know if i can help you further... Quote Link to comment https://forums.phpfreaks.com/topic/164627-global-terms-page-an-echo-include-and-variable-nightmare-help/#findComment-868228 Share on other sites More sharing options...
JonnoTheDev Posted July 3, 2009 Share Posted July 3, 2009 This is easy if all sites are on the same server. Store the terms content in a text file somewhere on your server i.e. /usr/local/php/includes/terms.txt In the text file use a tag where you will want to replace text on each site i.e. // terms.txt <p>Your use of [sITENAME] etc......</p> Then on each site get the contents of the file and use the str_replace function to replace the markers. If you have multiple markers use an array as parameters in the function i.e. <?php $terms = file_get_contents('/usr/local/php/includes/terms.txt'); $terms = str_replace("[sITENAME]", "mysite.com", $terms); print $terms; ?> Quote Link to comment https://forums.phpfreaks.com/topic/164627-global-terms-page-an-echo-include-and-variable-nightmare-help/#findComment-868300 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.