I’m designing some PHP pages which will pull in basic html text files from another directory.
Obviously the files I’m including need to be top-and-tail-ed of unnecessary markup, so that html tags etc. aren’t repeated.
Within these html text files, which are shorn of html and head tags, how do I incorporate such things as style instructions without this information actually displaying? Normally it’s in the head of the file, but these files have no
I DO want styling information in these html snippets, NOT in the main parent PHP file. The reason being that the client will be amending and updating and styling these html snippets. His changes and styles need to be in the snippet.
I would just set-up a separate stylesheet(s) for the snippets and have
the client edit that instead of the include file. He’s still editing
the CSS just that now it’s in a separate file.
The problem is this client is going to use Dreamweaver to edit html snippets and re-upload them by FTP. They’re pretty web savvy, but I wouldn’t cut them loose with CSS.
ie. they are going to be using a visual web authoring tool to get the page (snippet) looking as they want it, and then they’re going to upload their html page/snippet. I really can’t see them managing CSS classes.
There are JavaScript tricks which can do this, but you MUST have the
iframe source and the outer page (which holds the iframe) served from
the same server. If you try to do this with a multi-domain setup, you
won’t be able to access the innerHeight of the iframe, because that
would be a security violation (cross-domain request).
Walter
On Aug 7, 2009, at 1:58 PM, hugh wrote:
Just need to find an iFrame format that can automatically expand/
shrink according to amount of content…
No, the client needs to be able to do his changes and re-authoring of content in DWeaver. I fully endorse this, CMS is totally the wrong tool/method for them. They are very IT savvy, not at all stupid, and know exactly what they want to do and I fully agree and know the logic of it. Online tinkering about really doesn’t cut it - especially as they don’t have the best broadband connection in the world being out in the sticks a bit (as this country goes!)
It really does make sense for them to write their own html files and upload them,…and have them pulled into a"designed" site by SSI, PHP or iFrame…whatever.
If you make them a page in Freeway which they can whip, stir and
liquify in DW, and if they upload it into a separate folder on the
server (not into the main site root), you could write a text-
processing tool in PHP or Perl which would strip off the head and tail
before streaming the resulting fragment to the outer page on request.
It’s a pretty simple trick to find everything inside the body tag:
Then, all you have to do is make sure that they stick to the styles
you defined in the outer page and all will be well.
Walter
On Aug 7, 2009, at 3:02 PM, hugh wrote:
No, the client needs to be able to do his changes and re-authoring
of content in DWeaver. I fully endorse this, CMS is totally the
wrong tool/method for them. They are very IT savvy, not at all
stupid, and know exactly what they want to do and I fully agree and
know the logic of it. Online tinkering about really doesn’t cut it -
especially as they don’t have the best broadband connection in the
world being out in the sticks a bit (as this country goes!)
It really does make sense for them to write their own html files and
upload them,…and have them pulled into a"designed" site by SSI,
PHP or iFrame…whatever.
I’d have to get a fuller understanding of how that works, Walter. I’m not quite sure where I put that code you’re showing above (is that the sum of it?)
I tried an AJAX include from Dynamic Drive Dynamic Drive DHTML Scripts- Ajax Includes Script and that worked fine. However, any resources associated with the file being included don’t get displayed (eg. a little PDF icon I use) This is because FW is naturally writing to the Resources folder associated with the file, and the html file code of course refers to ‘Resources/pdficon.gif’…when in fact, once the file is “included” the path to that gif is different.
Using a standard PHP include also pulls the file in nicely, but again without the Resources.
One interesting note is that the PHP method displays all the code and text of the included page in the final output, which is good from a search engine viewpoint I would have thought. The AJAX method doesn’t show the code and text of the included page in the output. It makes the page lighter but less SE friendly?
I’m moving onto iFrames next - maybe that will solve the Resources issue.
iFrames prove to be the cleanest way of including the file. The iFrame also displays any of included file’s associated graphics, which is a problem with php and ssi (at least it is with a sensible directory structure).
The problem with iFrame is that it doesn’ t display the source of the included page - so there’s a lot of stuff that might be missed by search engines.
Question: do search engines ‘drill down’ from an php-include or SSI page to scan the content of the include source?
If it doesn’t compromise searchability, iFrames are the way to go.