Jump to content

Trying to make an Iframe site into a php include site... help!


Recommended Posts

Basically I have a site over at www.allFOTC.com and right now as you can see I'm using all Iframes. It works awesomely for function, but it's gotta be killing my SEO. I'd like to be able to have the same functionality but using php includes so it'll always look like one normal page as far as Search Engines are concerned. Would it be possible to create dynamically changing includes (like when someone wants to watch an ep, JUST the small center block changes to the video) without having to make each page with a full on layout? Right now it's so simple to go find a page I want to edit and only have to look at 5 or 6 lines of code. I'd hate to have to have full layouts on each page and have to fish through all that code to find something.

 

Can anyone steer me in the right direction here? I have very limited experience in PHP, but I'm a quick learner  :D

 

Thanks

I don't understand where exactly your stuck. The whole include() concept is pretty straignt forward. eg;

 

header.php

<html>
  <head>
    <title>foo</title>
  </head>
  <body>

 

footer.php

  </body>
</html>

 

content.php

<?php include 'header.php'; ?>
    <p>here is some content</p>
<?php include 'footer.php'; ?>

Yeap. Just set up the layout how you want it. In the content areas, put a simple php block like this:

echo file_get_contents("thatpage.htm");

 

You can have "thatpage.htm" be dynamically changed any way you want. A popular way is to make link in this sort of a format: index.php?page=thatpage. Then you can have simple code like:

echo file_get_contents($_GET['page'] . ".htm");

 

This particular code without any checks would allow someone to execute any htm files in that folder even if you don't have a link, so keep that in mind. For example, if you had a file called secret.htm, someone could type in index.php?page=secret and it would load it.

 

file_get_contents() is better to use than include() if it is not a php file being included.

I don't understand where exactly your stuck. The whole include() concept is pretty straignt forward. eg;

 

header.php

<html>
  <head>
    <title>foo</title>
  </head>
  <body>

 

footer.php

  </body>
</html>

 

content.php

<?php include 'header.php'; ?>
    <p>here is some content</p>
<?php include 'footer.php'; ?>

 

I know how to do a simple header/footer include, but I'd like for when people to click "Season 1", it'd load up the season 1 stuff in the episode block. And that season 1 stuff that's being loaded would just be a simple HTML file with content only in it, not the whole layout. I'm not explaining this very well I think.

 

Basically how the site works now, as you know, is the Season 1 link opens up season1eps.html (which is a tiny file of only content, no full site layout) in the side iframe. So it's really simple to make and update things. I'd like the same concept only using php instead of iframes so search engines will pick up on all the content.

 

@lemmin, I will look into your code examples. As I said, I'm a fairly large noob to php so I'll have to do some research on that code  ;)

 

file_get_contents() is better to use than include() if it is not a php file being included.

Can you expand on this? I have often wondered if using file_get_contents would in fact be better than include, but haven't actually looked into it.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.