Forum Moderators: phranque

Message Too Old, No Replies

using SSI to include certain parts of a html file

Server Side Includes

         

Istvan

8:49 pm on Sep 19, 2005 (gmt 0)

10+ Year Member



I am looking for a way by using SSI to include certain parts of a html file in many different pages. Is it possible that a test.html file has for example the characters: a,b,c,d and I have 4 pages: 1,2,3,4.html . Now I want to include on page 1.html the character "a", at page 2.html I want to include the character "b" etc . At all the number.html pages I link to: <!--#include virtual="test.html" -->

Is there a way of doing this by using SSI?

Thanks.

Istvan

decaff

10:50 pm on Sep 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If I understand your posting..

You would want to create each SSI file with a different designation:

<!--#include virtual="test.html" --> would become

<!--#include virtual="testa.html" -->
<!--#include virtual="testb.html" -->
<!--#include virtual="testc.html" -->
<!--#include virtual="testd.html" --> and so on...
and then each of the html pages

=> page1.html would pull in SSI testa.html with whatever content you want to include in this file
=> page2.html would pull in SSI testb.html with whatever
content you would to include in this file ... and so on..

is this what you want to achieve...? if so then it is very doable...

Istvan

6:33 am on Sep 20, 2005 (gmt 0)

10+ Year Member



Hi,

At the moment we indeed use testa.html, testb.html etc.

But I was wondering if it is possible to put all the files in test.html and include in the pages where I want to include some parts of test.html that part. And another page I include also test.html but then the next paragraph which is shown at test.html.

So instead of using:

!--#include virtual="test.html" --> would become

<!--#include virtual="testa.html" -->
<!--#include virtual="testb.html" -->
<!--#include virtual="testc.html" -->
<!--#include virtual="testd.html" --> and so on...

I want to use only!--#include virtual="test.html" --> and specify at page 1.html that there is a need to include a certain paragraph of the text in test.html. At page 2.html I only want to include from test.html a table. Is this possible in this way?

mcavic

7:48 am on Sep 20, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Nope, SSI includes are all or nothing.

Istvan

8:00 am on Sep 20, 2005 (gmt 0)

10+ Year Member



Is there no other way of achieving this? It does not need to be with SSI, but as I deal with hotels updating their rates, I would like to do it in a central file. In such a way that I do not need to open hundreds of pages a time to update and save the changes.

kaled

9:52 am on Sep 20, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I am far from certain that I have understood the problem correctly, but here goes.

You cannot include part of a file, but by using CSS you can ensure only part of a file is displayed.

Within the included file, each displayable section must be placed within its own div. Each div must have either a unique id or a shared class. Each calling page must then use css instructions to show the required section. If included data must appear inline use span instead of div.

Having said that, if you are talking about hundreds or thousands of sections, then a perl/php solution would be more efficient.

Kaled.

Istvan

11:24 am on Sep 20, 2005 (gmt 0)

10+ Year Member



Kaled, Thanks for your suggestion. The CSS way of doing this, where do I specify the first part of data which I can display on one page, and for another page I use the second part of the data (where: data = a list of tables)?

Is this done in an external file or you just put all the different data (tables in my case) on all pages and just place a div (and the rest you treat as an hidden field) for the tables which I want to display at a certain page?

Is this hidden css stuff not dangerous in that way that Google might look at it as a form of spam (hidden fields)?

Istvan

kaled

1:32 pm on Sep 20, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Every page would need unique CSS instructions. Without knowing how the data is structured, I cannot offer a specific css solution. The fact that some text would be hidden is potentially a problem but search engines don't generally look at css files.

Use of perl/php to provide a server-side solution may well be preferable and probably would be straightforward.

Kaled.