Forum Moderators: phranque

Message Too Old, No Replies

Nested comments headache

<!-- " " --> in <!-- " " -->

         

Alioc

1:31 am on May 1, 2006 (gmt 0)

10+ Year Member



Getting mad trying to find a way to make this work guys:

<!--#include virtual="/search.php?query=<!--#echo var="VAR_smtg" -->" -->

<!--#echo var="VAR_smtg" --> is the keyword I want to pass as the query above but the full string can't be passed correctly. The variable is being broken because of the same start<-- and end--> tags. The final query passed to search.php is only the <!-- part. :O

Thought of setting a new variable by using the old one with php but all of the pages are .html, and the server couldn't run php on .html with the .htaccess trick. Can you think of any other way?

Made it work using a cgi script and calling the search.php results by it but that's a bad solution regarding SEO.

<script src="/cgi-bin/script.cgi?/search.php?query=<!--#echo var="VAR_smtg" -->"></script>

Any ideas? How could you solve this? Thank you very much.

PS. Can't even pull my hair; got a complete hair cut! lol

jdMorgan

2:03 am on May 1, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Based on this [httpd.apache.org]:

Variable Substitution

Variable substitution is done within quoted strings in most cases where they may reasonably occur as an argument to an SSI directive. This includes the config, exec, flastmod, fsize, include, and set directives, as well as the arguments to conditional operators. You can insert a literal dollar sign into the string using backslash quoting:

(emphasis added)

I'd try this:


<!--#include virtual="/search.php?query=$VAR_smtg" -->

Another option is to include an intermediate PHP script... call it lookup.php. Then have lookup.php dereference the VAR_smtg variable, and do a PHP include of the correct search.php+query

Jim

Alioc

3:34 am on May 1, 2006 (gmt 0)

10+ Year Member



You're the man Jim. That works like a charm! OMG how cool that simple code looks, doesn't it?!

I can't thank you enough. Please don't hesitate to PM me if/when you need a graphical type of job done. I'd be glad to help.