Use php to load a page in a page?

Reply

Join Date: Feb 2005
Posts: 427
Reputation: autocrat is on a distinguished road 
Solved Threads: 12
autocrat autocrat is offline Offline
Posting Pro in Training

Use php to load a page in a page?

 
0
  #1
Apr 3rd, 2005
OK, I've looked at CMS's, I've thought hard about the best approach to permit/enable clients to alter their content etc..... and I'm stunned at the vast array of basically limitless powqer this app's permit.... yet none of them are simple enough or small enough to just dump and let an idiot use, nor are they capable of permitting the client to alter "their area" without flaming mine.... unless I build sites around a CMS system.... which for small business sites strikes me as daft....

SO

Does the idea of having a html/xtml page as a template, with a section that loadfs another page into sound a smart way to go? This seperates their content from the design etc... so they can't break the site or try creating new sections etc... merely alter existing content.

If this does seem sensible, how do i go about using PHP to set up an area on the web page that calls up a seperate page, (the former page is the tmeplate I make, the latter page is their content!).

Any suggestions?
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 355
Reputation: DanceInstructor is an unknown quantity at this point 
Solved Threads: 14
DanceInstructor's Avatar
DanceInstructor DanceInstructor is offline Offline
Posting Whiz

Re: Use php to load a page in a page?

 
0
  #2
Apr 3rd, 2005
There is more than one way to do this. Do you want to use an i-frame (probably not)? If not this is one way:

[HTML]<html>
<head>
stuff..
</head>
<body>
template stuff...
<!-- time for user content -->
<?php
include_once('user_content.php');
?>
more template stuff...
</body>
</html>[/HTML]

As far as I know for this to work the template page has to have the extension .php
Clear Mind Hosting and Web Design

If I've helped you please consider adding to my reputation.
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 427
Reputation: autocrat is on a distinguished road 
Solved Threads: 12
autocrat autocrat is offline Offline
Posting Pro in Training

Re: Use php to load a page in a page?

 
0
  #3
Apr 3rd, 2005
I've been thinking about this... and it is (should be) easily implemented... .yet the drawback is that the page's content becomes non-SEO....as they are created at the time.

What I need to do is find a way of parsing then making the changes permenant... till the next time!

This is so stupid! The only reason to do this is because we have a couple of clients that have no idea as to what they are wanting, and just want to sound big.... 14 static pages.... update once a month.... why the CMS!
Sheesh!
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 234
Reputation: PoA is an unknown quantity at this point 
Solved Threads: 8
PoA PoA is offline Offline
Posting Whiz in Training

Re: Use php to load a page in a page?

 
0
  #4
Apr 3rd, 2005
Which cms are you using? For my case, I use

$_SERVER['REQUEST_URL']
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 355
Reputation: DanceInstructor is an unknown quantity at this point 
Solved Threads: 14
DanceInstructor's Avatar
DanceInstructor DanceInstructor is offline Offline
Posting Whiz

Re: Use php to load a page in a page?

 
0
  #5
Apr 4th, 2005
Well you could have the header and footer info in 2 files. Then when they update you could have a script read the header file into a string, then add the updated content to the string, then read the footer file into the string as well. Take the complete string and write it to a .html file.

Unfortunately there is no perfect solution.

The other option is to use mod_rewrite to make the search engine see the php page as static. Like Daniweb has done
Clear Mind Hosting and Web Design

If I've helped you please consider adding to my reputation.
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 348
Reputation: paradox814 is an unknown quantity at this point 
Solved Threads: 4
paradox814's Avatar
paradox814 paradox814 is offline Offline
Posting Whiz

Re: Use php to load a page in a page?

 
0
  #6
Apr 4th, 2005
why don't you just tell them to do add this to ever page
[php]
require "/home/domain/header1.php";

//there code goes here

require "/home/domain/header2.php";
[/php]

Or, you could also so a server side include (SSI) this is an apache thing so that it will do it for you.

Or last but not least, you can modify htm and html files to load as php files using .htaccess AddType stuff but it will require the server to be restarted, or if u don't have permission to restart it waiting at least a day or two or however long until the server is restarted. once you have done this use the mod_rewrite feature to call your own scripts and make them all link your original php page
[php]
<html>
<head> stuff.. </head>
<body>

template stuff... <!-- time for user content -->
<?php include_once('user_content.php') ?>
more template stuff...
</body>
</html>
[/php]
please not that while this third option may seem like the best (if you are not a server administrator), but please take note: this is generally a bad idea, as doing this will slow down the entire site! it the site isn't too big you might never notice it, but if it grows in size it might start to become a headache in which case you should look for dedicated hosting
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 427
Reputation: autocrat is on a distinguished road 
Solved Threads: 12
autocrat autocrat is offline Offline
Posting Pro in Training

Re: Use php to load a page in a page?

 
0
  #7
Apr 4th, 2005
OK.... erm.... der.... gee george.... wtf?

I have no idea... but thank ytou all for posting!
LOL

OK, I take it that is eseveral different methods to utilise php to call up the content, or to permit the client to allter the html, and call up the hdr/ftr etc.

I think I understand the application of ... mod_rewrite ... yet have no idea how to implement it.
(php is coming after css in the learning curve, which wobbles alot lately LOL!)

So, succinctly, it IS possible to have the code broken down so that I have a templated page, enable the page to load in a section via php, and convinve the server/search engines that it is a static page?

Is that correct? If so, then I think that will do... I'll just find a simple html/browser based txt esdito to let them connect and alter their part of things! easy!
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 355
Reputation: DanceInstructor is an unknown quantity at this point 
Solved Threads: 14
DanceInstructor's Avatar
DanceInstructor DanceInstructor is offline Offline
Posting Whiz

Re: Use php to load a page in a page?

 
0
  #8
Apr 5th, 2005
Yeah what you said. Easy!

lol
Clear Mind Hosting and Web Design

If I've helped you please consider adding to my reputation.
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 427
Reputation: autocrat is on a distinguished road 
Solved Threads: 12
autocrat autocrat is offline Offline
Posting Pro in Training

Re: Use php to load a page in a page?

 
0
  #9
Apr 6th, 2005
Is that sarcasm?
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC