Jump to content

  • Log in with Facebook Log in with Twitter Log In with Google      Sign In   
  • Create Account

Subscribe to HRA Now!

 



Are you a Google Analytics enthusiast?

Share and download Custom Google Analytics Reports, dashboards and advanced segments--for FREE! 

 



 

 www.CustomReportSharing.com 

From the folks who brought you High Rankings!


Sponsored Content

 

 
 

Photo
- - - - -

What's The Best Include Method?


  • Please log in to reply
24 replies to this topic

#1 MrLeN

MrLeN

    HR 2

  • Active Members
  • PipPip
  • 33 posts

Posted 27 November 2004 - 10:27 AM

I currently have several sites running and I use php to make includes within all sites on the server. This is all cool and makes things very easy and all, but I have a problem..

I want to start adding my template to many 3rd party sites and portals. If I do this I have to upload/insert a static copy of my template, because of course I can't use the php includes on sites/pages that aren't on my server. Therefor, every time I modify/add to/change my template, I have to spend a LONG time modifying every 3rd party version - and it's giving me the IRRITS!

I could use Iframes, because search engines can find them, and I can block the search engines from listing the actual contents of the Iframes, and I can make them but of course this is messy and very unprofessional, and there are several unsavory problems Iframes cause that can't be fixed.

I could use Javascript, but yeah, we're in 2004 now (almost 2005). Also, using Javascript will do jack for my SEO efforts.

That leaves me with XML. However, how on earth can I get a .php page to use/parse .xml?

I have tried to find this out before, I have spend many hours searching the Internet for ways to make some sort of include system for xml/php. I have had limited success, but to be quite honest it's all very confusing for me.

I tried building my site with XML, but when my server wouldn't parse it (after the days I spent "straight" learning how to make an XML page) I totally gave up.. very angry. Ok, so I work out how to make my server parse xml? What of the 3rd party servers can't parse xml? Sheeesh, web design can get annoying!

Also, some of the 3rd party sites are .asp!

So, this is really hard for me to figure out.

Maybe xml isn't the answer. But how on earth can I include content in a 3rd party site without using Iframes or Javascript?

If someone can tell me a way to do this without having to study something for 3 weeks straight, you'll become my hero!

MrLeN

#2 Randy

Randy

    Convert Me!

  • Moderator
  • 17,540 posts

Posted 27 November 2004 - 11:10 AM

umm... You can use PHP includes across sites and across servers MrLen. wink.gif I do it all the time!

CODE
include('http://www.someothersite.com/includefile.php');


You update that one file and it automagically updates the display on every site that accesses that file.

Don't be telling everybody that though. Because I don't want to start seeing my entire site end up on someone else's domain. lol.gif

#3 cyanide

cyanide

    HR 3

  • Active Members
  • PipPipPip
  • 93 posts
  • Location:Toronto, Canada

Posted 27 November 2004 - 01:17 PM

LOL

Randy just echoed my answer. It's definitely doable

#4 MrLeN

MrLeN

    HR 2

  • Active Members
  • PipPip
  • 33 posts

Posted 27 November 2004 - 11:27 PM

You're joking??

ALL this time???

Going to test.. crossfingers.gif

MrLeN

#5 MrLeN

MrLeN

    HR 2

  • Active Members
  • PipPip
  • 33 posts

Posted 27 November 2004 - 11:39 PM

WOW - WOW !!

YEP, YOU'RE MY HERO!

How on earth didn't I know that? I am absolutely positive that I wanted to do this previously, but was told that it couldn't be done. Is this a new php thing? ie: Something that was added in the last year or so?

I am extremely happy cheers.gif

drunk.gif

bubbly.gif

Thank you!!

*Goes off to S&R all templates*

MrLeN biggrin.gif

#6 MrLeN

MrLeN

    HR 2

  • Active Members
  • PipPip
  • 33 posts

Posted 27 November 2004 - 11:47 PM

Hmmm, um.. now I have like, another problem..

One third party site is in .html and another is in .asp - lol

Uh, I don't suppose there's any chance I can get such pages to parse php? hmm.gif

MrLeN wacko.gif

#7 MrLeN

MrLeN

    HR 2

  • Active Members
  • PipPip
  • 33 posts

Posted 28 November 2004 - 12:29 AM

I have another problem too.

I tested the include on a page and it worked fine, but when I tried to use it on a third party portal/template, the page wont load.

I am guessing that it's because the actual page starts with

<?

and ends with

?>

and my content is in between, so I can't use:

<? include("http://www.mysite.co...es/include.php"); ?>

How would I format the above line in such a case?

I am currently searching the net, trying to find out how, but not luck yet.

MrLeN

#8 cyanide

cyanide

    HR 3

  • Active Members
  • PipPipPip
  • 93 posts
  • Location:Toronto, Canada

Posted 28 November 2004 - 12:44 AM

QUOTE(MrLeN @ Nov 27 2004, 11:47 PM)
Hmmm, um.. now I have like, another problem..

One third party site is in .html and another is in .asp - lol

Uh, I don't suppose there's any chance I can get such pages to parse php?  hmm.gif

MrLeN  wacko.gif

I don't know how new it is, but I've known about it for a while...

If you are trying to include an html or asp page inside php, it should work.

If the entire page is surrounded by <? ?> , then yes you will have to strip them from the include, so
CODE
include("http://www.mysite.com/includes/include.php");

should do it..

#9 MrLeN

MrLeN

    HR 2

  • Active Members
  • PipPip
  • 33 posts

Posted 28 November 2004 - 01:04 AM

Thanks cyanide ,

QUOTE
If you are trying to include an html or asp page inside php, it should work.


I actually want to go the other way around. I want to know if there is any code that I can use to call php from a .html page or an .asp page.

QUOTE
If the entire page is surrounded by <? ?> , then yes you will have to strip them from the include, so


I just tried this.. All it does it display the actual code. ie: Just as if it was a line of text.

MrLeN

#10 Scottie

Scottie

    Psycho Mom

  • Admin
  • 6,293 posts
  • Location:Columbia, SC

Posted 28 November 2004 - 01:53 AM

You can use an include on an .asp page using a slightly different code format:

<!--#INCLUDE FILE="header.asp"-->


For html pages, you can parse the html code as php if you are on a nix server.

#11 MrLeN

MrLeN

    HR 2

  • Active Members
  • PipPip
  • 33 posts

Posted 28 November 2004 - 02:25 AM

Like this?

http://www.newezone....orted/test.html

It doesn't seem to work.

MrLeN

#12 chrishirst

chrishirst

    A not so moderate moderator.

  • Moderator
  • 5,882 posts
  • Location:Blackpool UK

Posted 28 November 2004 - 04:10 AM

couple of questions first.

On the third party site are you just wanting to put the same page page directly on the server and have it run or can it be a remote include ?

is there any php executable code in the include or is it simply html?

does the html site support SSI at all?

#13 MrLeN

MrLeN

    HR 2

  • Active Members
  • PipPip
  • 33 posts

Posted 28 November 2004 - 09:34 AM

Well, I have three main sites that have my template on it, but I have absolutely no control over the server whatsoever.

one site is in PHP, so I can use PHP includes (which I haven't got working yet, even so).

One site is in static HTML pages (generated by Perl, I believe).

One site is in .asp

In all three of these sites, the only way I have to get my template uploaded is by cutting and pasting a copy of my template header and footer into a text area.

What makes it harder is that one of the 3rd party sites wont let me cut my whole header and footer. They have a different text area for each part of the template, so that people's code fit's in with the way "they" want their site structured.

I don't mind using SSI as well as PHP includes, just as long as I don't have to keep going back to change the templates.

If I can work out how to pull content from MY server, I intend on making use of many more 3rd party content/service providers for use with my template, but not if I have to change every single template, every single time I change something.

MrLeN

#14 Randy

Randy

    Convert Me!

  • Moderator
  • 17,540 posts

Posted 28 November 2004 - 10:16 AM

Not having control over the server may be a problem.

You could try seeing if the server is configured so that it will allow you to tell it that you want html files pre-processed by php. It may or may not work, depending upon the server's configuration.

To do that you would stick the following in an .htaccess file at the root level.
CODE
AddType application/x-httpd-php .htm .html


If it works, you can then put php code into your html pages and they'll run just as if they were php. That's going to be a pretty dicey proposition if you try to expand it out to other third party sites though. Some servers will allow it and just as many or more won't.

I'll leave ASP ideas to Chris. He's a lot more familiar with what it can and can't do than I am.

#15 MrLeN

MrLeN

    HR 2

  • Active Members
  • PipPip
  • 33 posts

Posted 28 November 2004 - 10:24 AM

I have contact with all three portal owners, but I don't think they'd be interested in my ideas (not many people usually are lol).

Sigh.. thinks.. taps fingers..

I don't want to have to use Iframes...

I suppose I could make an Iframe call the same documents that my includes are calling for the third party environments, and just use includes for pages that reside on my server.

However, I'd have to have a CSS reference at the top of every include file. That would kinda suck. But at least.. if I change the include, every site will be updated, no matter how many servers my template is spread across.

I think I'll just put this in the too hard box and come back in a year or two. Maybe something will have been invented by then.

MrLeN




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users