welcome to WebmasterWorld [webmasterworld.com], Ash!
i am assuming you are searching for "[DATA]" in the template and replacing it with the search results?
try hiding the "[DATA]" and replacing the entire string.
Thank you for your reply:
I have tried what you suggested but this results with nothing being displayed unfortunately.
When you search/replace the text, you must get rid of this attribute:
That's only for when there is no data to display.
After you have some data, you need to make it visible.
It's easy to get rid of
because you're replacing the whole tag with new text, including a new tag to contain the results.
you have to replace the entire string including the div element tag, not just the "[DATA]".
I have created 2 identical pages with the same content but different extentions.
The index.html page has the domain search on and the index.htmlt has both the domain search and the [DATA] tag on, when you search for a domain on the index.html, it calls to the index.htmlt [DATA] and displays the results on the index.htmlt page, this has the appearence that the index.html page is not changing when in fact it is.
you should make sure your serve is sending the correct content type header for the index.htmlt response:
also you want to consider if there will be any negative effects of having duplicate content if/when both urls are indexed.
You may use SSI include, but using Perl from HTML is not recommended. You need to submit form to a Perl program and read template from there.
|using Perl from HTML is not recommended |
I'm curious why that is.
Here is a method that works fine on my test server for a similar type of thing. I was going to suggest it to the OP, but it's rather involved, perhaps more than they wanted to deal with. Is there a reason not to do it this way?
The web page is an .html file that has PHP code in it, with the server properly configured to run the PHP code.
The page contains an HTML form that posts to the same page:
<form method="post" action="">
A block of PHP code in the page tests whether there was any form data submitted.
If there was no form data, the page is just rendered normally, without trying to process or put on the page form data that doesn't exist.
However, if there was form data submitted, PHP code sanitizes and validates it, then passes the submitted data to a Perl script:
$cmd = escapeshellcmd('perl -wT ' . escapeshellarg("path/to/my/script.pl") . 'various args');
$output = shell_exec($cmd);
$output contains whatever text the Perl script generated, which PHP then puts on the .html page at the needed location.
It seems to me the advantage is that it uses PHP for what it is good at: being embedded in the page to easily generate HTML code where it's needed, while Perl is used for the heavy text processing where speed is required, but not used for actually generating the HTML page, which (at least from my standpoint of Perl inexperience) is sort of cumbersome.
|It seems to me the advantage is that it uses PHP for what it is good at: being embedded in the page to easily generate HTML code where it's needed, while Perl is used for the heavy text processing where speed is required, but not used for actually generating the HTML page, which (at least from my standpoint of Perl inexperience) is sort of cumbersome. |
Embedding code into HTML is considered bad style in any language, most PHP programmers do not know this, so it is used frequently. But even PHP has template systems.
I use Template Toolkit, other use other systems like HTML::Template. CGI::FastTemplate has even sevtral ports to PHP.
Also you can embed code into HTML in Perl too, but due to being not recommended, and requiring to install CPAN modules, it is not used frequently.