Jump to content

SSI variables containing HTML code


richpasco

Recommended Posts

This might be a FAQ, but I couldn't find it...

 

I want to define some server-side includes (SSI) variables for some short HTML code snippets and use them in my SHTML files, like this:

[pre]

<!--#set var="hours" value="Monday–Friday<BR>8 a.m.–5 p.m." -->

...

<!--#echo var="hours" -->

[/pre]

My problem is that Apache "escapes" my intended HTML code and entities, so that the browser receives

[pre]

Monday&ndash;Friday<BR>8 a.m.&ndash;5 p.m.

[/pre]

and so it displays my HTML snippet instead of executing it.  How can I work around this problem?

 

One idea I had was to put each snippet into its own file and then include it, like this:

[pre]

<!--#include file="hours.shtml"  -->

[/pre]

The problem is, I have dozens of such snippets, and I don't want to clutter my disk with dozens of one-line files.  Are there any better ideas?

 

    - Rich

Link to comment
https://forums.phpfreaks.com/topic/47345-ssi-variables-containing-html-code/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.