|
Return an entire HTML document from a fragment June 10, 2009 11:39AM |
Registered: 3 years ago Posts: 8 |
Hi there.
I don't think this already exists, so I'm putting it in as a suggestion for now. I'd like to index HTML fragments with Zend_Search_Lucene, and from what I gather, it requires a whole HTML document (with metadata). I thought it would be nice to have a method that passes back a fragment of HTML as a valid full document, with title and metadata included. I feel that would be a useful feature, but I'm not sure of the other applications for this method.
All the best.
|
Re: Return an entire HTML document from a fragment June 10, 2009 12:42PM |
Registered: 5 years ago Posts: 204 |
you can do that with PHP anyway, no point reinventing the wheel.
you could either do it pre-processing or post-processing.
<pre><![CDATA[ $content_header = " <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd/"> <html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\"> <head> <title>Your title</title> <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" /> <meta name=\"robots\" content=\"index,follow\" /> <meta name=\"keywords\" content=\"your keywords\" /> <meta name=\"description\" content=\"Your Description\" /> <meta name=\"rating\" content=\"general\" /> <meta name=\"author\" content=\"the author\" /> <meta name=\"copyright\" content=\"Copyright © whatever\" /> <meta name=\"generator\" content=\"whatever\" /> </head> <body>";
$content_footer = " <P>your footer</p> </body> </html>";
$fragment = "Your HTML fragment goes here";
$complete_doc = $content_header.$fragment.$content_footer; ]]></pre>
then you filter either $complete_doc
or you can filter just $fragment on it's own, as long as you filter $fragment before you create $complete_doc.
the above is just an example and I haven't tested it, so code tweaking maybe needed. but i don't see the need for adding this feature when it could be done in PHP, and when done in PHP rather than through purifier, it is far easier in actually using on a dynamically changing site where meta_data will change.
that's just my opinion of course, i think that is what you are trying to achieve.
|
Re: Return an entire HTML document from a fragment June 10, 2009 01:06PM |
Admin Registered: 6 years ago Posts: 2,640 |
|
Re: Return an entire HTML document from a fragment June 10, 2009 01:32PM |
Registered: 3 years ago Posts: 8 |
|
Re: Return an entire HTML document from a fragment February 14, 2010 04:29PM |
Registered: 4 years ago Posts: 6 |