Log in

View Full Version : Returning value in Custom template


stryka
02-02-2003, 05:02 AM
here's the code i use...



<?php

require(getenv('DOCUMENT_ROOT').'/global.php');
$DB_site->query_first("SELECT id, name FROM names WHERE id = '$id'");
eval("dooutput(\"".gettemplate('customtemplate1)."\");");
?>


When i put the variable $name from the above query result into 'customtemplate1'... it doesn't show up... how do i write this code...

2nd part...

how do i write a function that only displays the template if 'id' exists...

Xenon
02-02-2003, 11:35 AM
part 1 and 2 in combo:

<?php

require(getenv('DOCUMENT_ROOT').'/global.php');
$var = $DB_site->query_first("SELECT id, name FROM names WHERE id = '$id'");
if($var) eval("dooutput(\"".gettemplate('customtemplate1)."\");");
?>


use $var[name] in your template