View Full Version : PHP eval support in templates
joeboe
09-13-2003, 10:14 PM
I'd like to see support for evaluating php that's built in to the template for phpDig.
Charter
09-14-2003, 08:46 AM
Here are two methods to include PHP in templates using XML-like tags.
Method One:
In function_phpdig_form.php, look for the following:
$result['form_head'] = "<form action='$result_page' method='get'>
and right before it, insert the following:
$result['put_unique_name_here'] = $do_php_here;
and then in the template, use the following:
<phpdig:put_unique_name_here/>
Method Two:
In search_function.php, look for the following:
$timer->start('Template parsing');
and right after it, insert the following:
$put_unique_name_here = $do_php_here;
and then in search_function.php, look for the following:
$t_mstrings = compact('title_message', // and so forth
and 'put_unique_name_here' into the line like so:
$t_mstrings = compact('put_unique_name_here','title_message', // and so forth
and then in the template, use the following:
<phpdig:put_unique_name_here/>
I know a very good method, in which: You don't need to alter all the other search_functions.php files etc. but only need to make a .HTACCESS file and it will parse PHP into HTML documents! Sneaky....
Anyway here it is:
Make a file name called .htaccess and add this code in it:
<Files phpdig.html>
ForceType application/x-httpd-php
</Files>
If you're using a different template than phpdig.html ,change the 'phpdig.html' into the file name (Only include for example template.html , not http://www.your_site.com/template.html)
And upload the .htaccess file into the 'templates' directory, I've tried it and it worked!
Cool!
WiseOne
12-08-2003, 10:37 PM
.htaccess
not working for me!
vBulletin® v3.7.3, Copyright ©2000-2025, Jelsoft Enterprises Ltd.