passing documents through pages [message #178334] |
Tue, 05 June 2012 20:58 |
Michael Joel
Messages: 42 Registered: October 2011
Karma: 0
|
Member |
|
|
I am wondering what people's opinions are for the following.
I am storing a library of documents online (the directly viewable ones
will be in HTML format - with other formats for the user to choose if
they wish to download them).
Anyway -
I have main site with PHP scripts taking user selection and then
providing the document for reading.
Since the documents are all stand alone html I want them to be viewed in
the website - ie. I want the sites menu, banner, and footer displayed
around the document.
Currently they are simply being read into the site's page but this is
wrong since this means CSS definitions are being loaded inside the page
body (not in the header).
I would like to keep the documents stand alone but also bring them in.
What would be the simplest method to load the document in?
I thought of iframes but I dislike that method. I could place the needed
CSS definitions in the site's page but then if viewed alone the
documents would not look right.
Like I said - any opinions?
If it is to complicated then I may just re-adjust the plan and force
them to be viewed through the site's pages only.
Thanks
Mike
|
|
|
Re: passing documents through pages [message #178336 is a reply to message #178334] |
Tue, 05 June 2012 22:13 |
The Natural Philosoph
Messages: 993 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
Michael Joel wrote:
> I am wondering what people's opinions are for the following.
>
> I am storing a library of documents online (the directly viewable ones
> will be in HTML format - with other formats for the user to choose if
> they wish to download them).
>
> Anyway -
> I have main site with PHP scripts taking user selection and then
> providing the document for reading.
> Since the documents are all stand alone html I want them to be viewed in
> the website - ie. I want the sites menu, banner, and footer displayed
> around the document.
>
> Currently they are simply being read into the site's page but this is
> wrong since this means CSS definitions are being loaded inside the page
> body (not in the header).
>
> I would like to keep the documents stand alone but also bring them in.
> What would be the simplest method to load the document in?
>
> I thought of iframes but I dislike that method. I could place the needed
> CSS definitions in the site's page but then if viewed alone the
> documents would not look right.
>
> Like I said - any opinions?
>
> If it is to complicated then I may just re-adjust the plan and force
> them to be viewed through the site's pages only.
>
If I understand you correctly, I would be inclined to make the raw
format of the pages HTML but lacking headers and so on.
Then you can make two sets of scripts - one set displays the pages
INSIDE e.g. a scrollable device bordered by your framework, and the
other just supplies a very basic html header for 'standalone viewing'
> Thanks
> Mike
>
--
To people who know nothing, anything is possible.
To people who know too much, it is a sad fact
that they know how little is really possible -
and how hard it is to achieve it.
|
|
|
Re: passing documents through pages [message #178338 is a reply to message #178334] |
Wed, 06 June 2012 08:34 |
alvaro.NOSPAMTHANX
Messages: 277 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
El 05/06/2012 22:58, Michael Joel escribió/wrote:
> I am storing a library of documents online (the directly viewable ones
> will be in HTML format - with other formats for the user to choose if
> they wish to download them).
>
> Anyway -
> I have main site with PHP scripts taking user selection and then
> providing the document for reading.
> Since the documents are all stand alone html I want them to be viewed in
> the website - ie. I want the sites menu, banner, and footer displayed
> around the document.
>
> Currently they are simply being read into the site's page but this is
> wrong since this means CSS definitions are being loaded inside the page
> body (not in the header).
>
> I would like to keep the documents stand alone but also bring them in.
> What would be the simplest method to load the document in?
>
> I thought of iframes but I dislike that method. I could place the needed
> CSS definitions in the site's page but then if viewed alone the
> documents would not look right.
>
> Like I said - any opinions?
>
> If it is to complicated then I may just re-adjust the plan and force
> them to be viewed through the site's pages only.
In other words, you want to combine programmatically two complete HTML
documents with their attached styles. It's quite a non-trivial task IMHO.
Your best chance is possibly to start with the library document and
inject your custom HTML boxes plus a link to your custom CSS document.
This can be accomplished with the Document Object Model extension:
http://es2.php.net/dom
You need to make sure that your custom styles are self contained and
have higher priority than other page elements (e.g., if your header uses
black fonts make sure you set an appropriate background colour so it
doesn't depend on the library document's colour). You'll get the best
results if the base document is valid HTML.
If you are more comfortable with JavaScript than with PHP, you can just
inject a <script> tag.
In any case, there's always the risk of breaking documents with complex
layout.
--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--
|
|
|
Re: passing documents through pages [message #178339 is a reply to message #178338] |
Wed, 06 June 2012 09:07 |
Erwin Moller
Messages: 228 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 6/6/2012 10:34 AM, "Álvaro G. Vicario" wrote:
> El 05/06/2012 22:58, Michael Joel escribió/wrote:
>> I am storing a library of documents online (the directly viewable ones
>> will be in HTML format - with other formats for the user to choose if
>> they wish to download them).
>>
>> Anyway -
>> I have main site with PHP scripts taking user selection and then
>> providing the document for reading.
>> Since the documents are all stand alone html I want them to be viewed in
>> the website - ie. I want the sites menu, banner, and footer displayed
>> around the document.
>>
>> Currently they are simply being read into the site's page but this is
>> wrong since this means CSS definitions are being loaded inside the page
>> body (not in the header).
>>
>> I would like to keep the documents stand alone but also bring them in.
>> What would be the simplest method to load the document in?
>>
>> I thought of iframes but I dislike that method. I could place the needed
>> CSS definitions in the site's page but then if viewed alone the
>> documents would not look right.
>>
>> Like I said - any opinions?
>>
>> If it is to complicated then I may just re-adjust the plan and force
>> them to be viewed through the site's pages only.
>
> In other words, you want to combine programmatically two complete HTML
> documents with their attached styles. It's quite a non-trivial task IMHO.
>
> Your best chance is possibly to start with the library document and
> inject your custom HTML boxes plus a link to your custom CSS document.
> This can be accomplished with the Document Object Model extension:
>
> http://es2.php.net/dom
>
> You need to make sure that your custom styles are self contained and
> have higher priority than other page elements (e.g., if your header uses
> black fonts make sure you set an appropriate background colour so it
> doesn't depend on the library document's colour). You'll get the best
> results if the base document is valid HTML.
>
> If you are more comfortable with JavaScript than with PHP, you can just
> inject a <script> tag.
>
> In any case, there's always the risk of breaking documents with complex
> layout.
>
>
Agree.
Depending on the existing stylesheets in the documents, this can become
very tricky (eg some absolute positioned elements, and misery like that,
might be very hard to handle right in an automated fashion.).
And if all documents have different stylesheets associated with each it
becomes a maintenance nightmare, and an IFrame might be the better
solution, even though they are discouraged.
In case all your documents use the same (or very similar) stylesheet(s),
you might be better off integrating that once into your existing site's
CSS.
If the documents have wildly different stylesheets, this is close to
impossible to accomplish, I expect.
I think much depends on such details, and we cannot judge those details
(but you can).
Maybe ask here: comp.infosystems.www.authoring.stylesheets
Some people over there might have bright ideas.
Good luck.
Regards,
Erwin Moller
--
"That which can be asserted without evidence, can be dismissed without
evidence."
-- Christopher Hitchens
|
|
|