Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How To Server Same Content On Several Sites From Same File

Featured Replies

Hi Folks

 

Let’s say I want to run several websites about my visits to different places. But on each site there is some similar content... Privacy and T&C’s for example.

 

The structure of my webserver is like this: www/httpd/vhtdocs/domains

 

Is it possible to place a file called say: var_ssiterms.php on the server - which can be embedded into several sites from a single file?

 

E.g:

 

www/httpd/vhtdocs/domain1

www/httpd/vhtdocs/domain2

www/httpd/vhtdocs/domain3

 

 

All displaying the same data.

 

Thanks.

Hi, one method is to use an "iframe". For example:

<iframe src="[url="http://www.bookingcalendar.info/calendar/theCalendar.asp?year=2010&id=18484"]http://www.bookingcalendar.info/calendar/theCalendar.asp?year=2010&id=18484[/url]"
width="100%" height="700"
align="right">
<p>See our <a href="[url="http://www.bookingcalendar.info/calendar/theCalendar.asp?year=2010&id=18484"]http://www.bookingcalendar.info/calendar/theCalendar.asp?year=2010&id=18484">Availability</a>.</p[/url]>
</iframe>

I use this on My Holiday Apartment site in order to grab the availabilty chart from another site. When they update my bookings, it appears on my site.

It also allows for alternative info to be displayed if the url is not available for some reason.

Sorry, I can't seem to get the code (above) to come out right. It is basically OK but it seems to missout some ">" characters. If I try to use the editor on this site to get it right, all hell breaks loose.

Perhaps someone can help me to understand how to use the

 mark-ups properly.

I'm basing this on the assumption that you have root access to the server... if not this is irrelevant.

 

Create a file called phpinfo.php and in it put this code:

<?php
phpinfo();
?>

 

Upload it to your webserver and run the script. Look for "include_path" - it should say something like this

.:/usr/share/php:/usr/share/pear

 

Taking the php one ('/usr/share/php') - upload var_ssiterms.php into that directory. You can now include this script in any php script on the server simply by including it.

include('var_ssiterms.php');

 

NB: You can add more universal include paths if you edit php.ini

 

Hope this helps.

  • Author

Thanks.

 

Ran the “phpinfo” and it gave me this at the “include_path’ as: .:/opt/php-uh5.2/lib/php - but when I tried to load a file to the directory “php” I got a permission denied. I’m guessing my host doesn't want me to write to that directory...

 

I also had a look at the ‘php.ini’ file and it all looks a bit serious and more than I know about. I’m a bit concerned about security - so I dare not change anything on that file until I know more.

Thanks.

 

Ran the “phpinfo” and it gave me this at the “include_path’ as: .:/opt/php-uh5.2/lib/php - but when I tried to load a file to the directory “php” I got a permission denied. I’m guessing my host doesn't want me to write to that directory...

 

I also had a look at the ‘php.ini’ file and it all looks a bit serious and more than I know about. I’m a bit concerned about security - so I dare not change anything on that file until I know more.

 

Did you go into the folder of /opt/php-uh5.2/lib/php or just /php ? You should be using the full path.

 

You can try adding a folder you know you have access to like /www/httpd/vhtdocs/domain1/globalincludes if you are up for editing php.ini ; about 780 lines down there are the listed include paths. Look for the one that doesn't have a ; before it, before the closing " mark put :/www/httpd/vhtdocs/domain1/globalincludes for example:

 

before;

; UNIX: "/path1:/path2"
include_path = ".:/php/includes"

after;

; UNIX: "/path1:/path2"
include_path = ".:/php/includes:/www/httpd/vhtdocs/domain1/globalincludes"

 

Let me know if you're having problems.

  • Author

Colin

 

Thanks for your help with this. I’m still struggling with my lack of knowledge. I’m very busy for the next few days - then I’ll have another bash at this.

 

I’ll post about how I get on in here.

 

Cheers

  • 2 weeks later...

Sorry if this sounds a bit simple but surely you could just do a simple include and place the full URL of the shared content in the include?

 

<?php
 include('http://your-domain-here.com/textdocument.txt');
?>

 

Place that on the sites that require the same text and boom, bobs your uncle?

 

It works for my sites, but they are all hosted with the same hosting company..

 

Chris

Sorry if this sounds a bit simple but surely you could just do a simple include and place the full URL of the shared content in the include?

 

<?php
 include('http://your-domain-here.com/textdocument.txt');
?>

 

Place that on the sites that require the same text and boom, bobs your uncle?

 

It works for my sites, but they are all hosted with the same hosting company..

 

Chris

 

You can't include http links. You can file_get_contents() them, but this won't load any preprocessing code.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.